get_sample_class_mlp — Return a training sample from the training data of a multilayer perceptron.
get_sample_class_mlp reads out a training sample from the multilayer perceptron (MLP) given by MLPHandle that was added with add_sample_class_mlp or read_samples_class_mlp. The index of the sample is specified with IndexSample. The index is counted from 0, i.e., IndexSample must be a number between 0 and IndexSamples - 1, where IndexSamples can be determined with get_sample_num_class_mlp. The training sample is returned in Features and Target. Features is a feature vector of length NumInput, while Target is a target vector of length NumOutput (see add_sample_class_mlp and create_class_mlp).
get_sample_class_mlp can, for example, be used to reclassify the training data with classify_class_mlp in order to determine which training samples, if any, are classified incorrectly.
Number of stored training sample.
Feature vector of the training sample.
Target vector of the training sample.
* Train an MLP create_class_mlp (NIn, NHidden, NOut, 'softmax', 'canonical_variates',\ NComp, 42, MLPHandle) read_samples_class_mlp (MLPHandle, 'samples.mtf') train_class_mlp (MLPHandle, 100, 1, 0.01, Error, ErrorLog) * Reclassify the training samples get_sample_num_class_mlp (MLPHandle, NumSamples) for I := 0 to NumSamples-1 by 1 get_sample_class_mlp (MLPHandle, I, Data, Target) classify_class_mlp (MLPHandle, Data, 1, Class, Confidence) Result := gen_tuple_const(NOut,0) Result[Class] := 1 Diffs := Target-Result if (sum(fabs(Diffs)) > 0) * Sample has been classified incorrectly endif endfor clear_class_mlp (MLPHandle)
If the parameters are valid, the operator get_sample_class_mlp returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
add_sample_class_mlp, read_samples_class_mlp, get_sample_num_class_mlp