Main Content

dividerand

Divide targets into three sets using random indices

Description

example

[trainInd,valInd,testInd] = dividerand(Q,trainRatio,valRatio,testRatio) takes the number of targets to divide up, the ratio of vectors for training, the ratio of vectors for validation, and the ratio of vectors for testing, and returns the training indices, the validation indices, and the test indices.

Examples

collapse all

This example shows how to obtain the training, validation, and test indices using the dividerand function.

Divide 3000 samples into 60% for training, 20% for validation, and 20% for testing.

[trainInd,valInd,testInd] = dividerand(3000,0.6,0.2,0.2)

Input Arguments

collapse all

Number of targets to divide up, specified as a scalar.

Ratio of vectors for training, specified as a scalar.

Ratio of vectors for validation, specified as a scalar.

Ratio of vectors for testing, specified as a scalar.

Output Arguments

collapse all

Training indices, returned as a row vector.

Validation indices, returned as a row vector.

Testing indices, returned as a row vector.

More About

collapse all

Network Use

Here are the network properties that define which data division function to use, what its parameters are, and what aspects of targets are divided up, when train is called.

net.divideFcn
net.divideParam
net.divideMode

Version History

Introduced in R2008a