ClassesClasses | | Operators

get_sample_class_mlpT_get_sample_class_mlpGetSampleClassMlpGetSampleClassMlp (Operator)

Name

get_sample_class_mlpT_get_sample_class_mlpGetSampleClassMlpGetSampleClassMlp — Return a training sample from the training data of a multilayer perceptron.

Signature

get_sample_class_mlp( : : MLPHandle, IndexSample : Features, Target)

Herror T_get_sample_class_mlp(const Htuple MLPHandle, const Htuple IndexSample, Htuple* Features, Htuple* Target)

void GetSampleClassMlp(const HTuple& MLPHandle, const HTuple& IndexSample, HTuple* Features, HTuple* Target)

HTuple HClassMlp::GetSampleClassMlp(Hlong IndexSample, HTuple* Target) const

static void HOperatorSet.GetSampleClassMlp(HTuple MLPHandle, HTuple indexSample, out HTuple features, out HTuple target)

HTuple HClassMlp.GetSampleClassMlp(int indexSample, out HTuple target)

Description

get_sample_class_mlpget_sample_class_mlpGetSampleClassMlpGetSampleClassMlpGetSampleClassMlp reads out a training sample from the multilayer perceptron (MLP) given by MLPHandleMLPHandleMLPHandleMLPHandleMLPHandle that was added with add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlp or read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlp. The index of the sample is specified with IndexSampleIndexSampleIndexSampleIndexSampleindexSample. The index is counted from 0, i.e., IndexSampleIndexSampleIndexSampleIndexSampleindexSample must be a number between 0 and IndexSamples - 1, where IndexSamples can be determined with get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpGetSampleNumClassMlp. The training sample is returned in FeaturesFeaturesFeaturesFeaturesfeatures and TargetTargetTargetTargettarget. FeaturesFeaturesFeaturesFeaturesfeatures is a feature vector of length NumInput, while TargetTargetTargetTargettarget is a target vector of length NumOutput (see add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlp and create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlp).

get_sample_class_mlpget_sample_class_mlpGetSampleClassMlpGetSampleClassMlpGetSampleClassMlp can, for example, be used to reclassify the training data with classify_class_mlpclassify_class_mlpClassifyClassMlpClassifyClassMlpClassifyClassMlp in order to determine which training samples, if any, are classified incorrectly.

Execution Information

Parameters

MLPHandleMLPHandleMLPHandleMLPHandleMLPHandle (input_control)  class_mlp HClassMlp, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

MLP handle.

IndexSampleIndexSampleIndexSampleIndexSampleindexSample (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of stored training sample.

FeaturesFeaturesFeaturesFeaturesfeatures (output_control)  real-array HTupleHTupleHtuple (real) (double) (double) (double)

Feature vector of the training sample.

TargetTargetTargetTargettarget (output_control)  real-array HTupleHTupleHtuple (real) (double) (double) (double)

Target vector of the training sample.

Example (HDevelop)

* Train an MLP
create_class_mlp (NumIn, NumHidden, NumOut, 'softmax', \
                  'canonical_variates', NumComp, 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(NumOut,0)
    Result[Class] := 1
    Diffs := Target-Result
    if (sum(fabs(Diffs)) > 0)
        * Sample has been classified incorrectly
    endif
endfor
clear_class_mlp (MLPHandle)

Result

If the parameters are valid, the operator get_sample_class_mlpget_sample_class_mlpGetSampleClassMlpGetSampleClassMlpGetSampleClassMlp returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlp, read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlp, get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpGetSampleNumClassMlp

Possible Successors

classify_class_mlpclassify_class_mlpClassifyClassMlpClassifyClassMlpClassifyClassMlp, evaluate_class_mlpevaluate_class_mlpEvaluateClassMlpEvaluateClassMlpEvaluateClassMlp

See also

create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlp

Module

Foundation


ClassesClasses | | Operators