splitForTrainingAndTest

0th

Percentile

Function to split data into training and test set

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:

inputsTrain

a matrix containing the training inputs

targetsTrain

a matrix containing the training targets

inputsTest

a matrix containing the test inputs

targetsTest

a matrix containing the test targets

Aliases
  • splitForTrainingAndTest
Examples
# 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])

splitForTrainingAndTest(irisValues, irisTargets, ratio=0.15)
# }
Documentation reproduced from package RSNNS, version 0.4-12, License: LGPL (>= 2) | file LICENSE

Community examples

Looks like there are no examples yet.