Accord.MachineLearning.Bootstrap.CreatePartitions C# (CSharp) Method

CreatePartitions() public method

Gets the indices for the training and validation sets for the specified validation fold index.
public CreatePartitions ( int index, int &trainingSet, int &validationSet ) : void
index int The index of the validation fold.
trainingSet int The indices for the observations in the training set.
validationSet int The indices for the observations in the validation set.
return void
        public void CreatePartitions(int index, out int[] trainingSet, out int[] validationSet)
        {
            if (index < 0 || index >= Subsamples.Length)
                throw new ArgumentOutOfRangeException("index");

            // Create indices for the foldings

            // The training set is already computed
            trainingSet = Subsamples[index];

            // The validation set is the complement of the training set
            validationSet = Vector.Range(0, Samples).Except(trainingSet).ToArray();
        }