Main Content

divideind

Divide targets into three sets using specified indices

Description

[trainInd,valInd,testInd] = divideind(Q,trainInd,valInd,testInd) separates targets into three sets: training, validation, and testing, according to indices provided. It actually returns the same indices it receives as arguments; its purpose is to allow the indices to be used for training, validation, and testing for a network to be set manually.

The indices are returned after removing any indices greater than Q. Note that some indices in the range 1:Q may not be assigned to any of the three sets, and the same indices should not be used in more than one set.

example

Examples

collapse all

This example shows how to divide samples into three sets using specified indices for a network.

Divide 20 samples into training, validation and test indices, so that only 16 are actually used.

[trainInd,valInd,testInd] = divideind(20,1:8,9:12,14:16)

This code shows you how to ensure a network performs the same kind of data division when it is trained:

net.divideFcn = 'divideind';
net.divideParam.trainInd = 1:8;
net.divideParam.valInd = 9:12;
net.divideParam.testInd= 14:16;

Input Arguments

collapse all

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

Training indices, specified as a 1-by-Q vector.

Validation indices, specified as a 1-by-Q vector.

Testing indices, specified as a 1-by-Q vector.

Output Arguments

collapse all

Training indices, returned as a vector.

Validation indices, returned as a vector.

Testing indices, returned as a vector.

More About

collapse all

Network Use

These 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