normTrainingAndTestSet: Function to normalize training and test set

View source: R/reg_class.R

normTrainingAndTestSetR Documentation

Function to normalize training and test set

Description

Normalize training and test set as obtained by splitForTrainingAndTest in the following way: The inputsTrain member is normalized using normalizeData with the parameters given in type. The normalization parameters obtained during this normalization are then used to normalize the inputsTest member. if dontNormTargets is not set, then the targets are normalized in the same way. In classification problems, normalizing the targets normally makes no sense. For regression, normalizing also the targets is usually a good idea. The default is to not normalize targets values.

Usage

normTrainingAndTestSet(x, dontNormTargets = TRUE, type = "norm")

Arguments

x

a list containing training and test data. Usually the output of splitForTrainingAndTest.

dontNormTargets

should the target values also be normalized?

type

type of the normalization. This parameter is passed to normalizeData.

Value

a named list with the same elements as splitForTrainingAndTest, but with normalized values. The normalization parameters are appended to each member of the list as attributes, as in normalizeData.

See Also

splitForTrainingAndTest, normalizeData, denormalizeData, getNormParameters

Examples

data(iris)
#shuffle the vector
iris <- iris[sample(1:nrow(iris),length(1:nrow(iris))),1:ncol(iris)]

irisValues <- iris[,1:4]
irisTargets <- decodeClassLabels(iris[,5])

iris <- splitForTrainingAndTest(irisValues, irisTargets, ratio=0.15)
normTrainingAndTestSet(iris)

RSNNS documentation built on May 29, 2024, 4:37 a.m.