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 stored with add_sample_class_mlp. The index of the sample is specified with NumSample. The index is counted from 0, i.e., NumSample must be a number between 0 and NumSamples - 1, where NumSamples 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.
|
MLPHandle (input_control) |
class_mlp -> integer |
| MLP handle. | |
|
NumSample (input_control) |
integer-array -> integer |
| Number of stored training sample. | |
|
Features (output_control) |
real-array -> real |
| Feature vector of the training sample. | |
|
Target (output_control) |
real-array -> real |
| 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 handling is raised.
get_sample_class_mlp is reentrant and processed without parallelization.
add_sample_class_mlp, read_samples_class_mlp, get_sample_num_class_mlp
classify_class_mlp, evaluate_class_mlp
Foundation