RSNNS (version 0.4-12)

normTrainingAndTestSet: 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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataCamp Workspace