RSNNS (version 0.4-9)

splitForTrainingAndTest: Function to split data into training and test set

Description

Split the input and target values to a training and a test set. Test set is taken from the end of the data. If the data is to be shuffled, this should be done before calling this function.

Usage

splitForTrainingAndTest(x, y, ratio = 0.15)

Arguments

x
inputs
y
targets
ratio
ratio of training and test sets (default: 15% of the data is used for testing)

Value

a named list with the following elements: a named list with the following elements:

Examples

Run this code
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])

splitForTrainingAndTest(irisValues, irisTargets, ratio=0.15)

Run the code above in your browser using DataLab