get_sample_class_mlpT_get_sample_class_mlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp (Operator)

Name

get_sample_class_mlpT_get_sample_class_mlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp — 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)

def get_sample_class_mlp(mlphandle: HHandle, index_sample: int) -> Tuple[Sequence[float], Sequence[float]]

Description

get_sample_class_mlpget_sample_class_mlpGetSampleClassMlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp reads out a training sample from the multilayer perceptron (MLP) given by MLPHandleMLPHandleMLPHandleMLPHandleMLPHandlemlphandle that was added with add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp or read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp. The index of the sample is specified with IndexSampleIndexSampleIndexSampleIndexSampleindexSampleindex_sample. The index is counted from 0, i.e., IndexSampleIndexSampleIndexSampleIndexSampleindexSampleindex_sample must be a number between 0 and NumSamplesNumSamplesNumSamplesNumSamplesnumSamplesnum_samples - 1, where NumSamplesNumSamplesNumSamplesNumSamplesnumSamplesnum_samples can be determined with get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpGetSampleNumClassMlpget_sample_num_class_mlp. The training sample is returned in FeaturesFeaturesFeaturesFeaturesfeaturesfeatures and TargetTargetTargetTargettargettarget. FeaturesFeaturesFeaturesFeaturesfeaturesfeatures is a feature vector of length NumInputNumInputNumInputNumInputnumInputnum_input, while TargetTargetTargetTargettargettarget is a target vector of length NumOutputNumOutputNumOutputNumOutputnumOutputnum_output (see add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp and create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp).

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

Execution Information

Parameters

MLPHandleMLPHandleMLPHandleMLPHandleMLPHandlemlphandle (input_control)  class_mlp HClassMlp, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

MLP handle.

IndexSampleIndexSampleIndexSampleIndexSampleindexSampleindex_sample (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of stored training sample.

FeaturesFeaturesFeaturesFeaturesfeaturesfeatures (output_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Feature vector of the training sample.

TargetTargetTargetTargettargettarget (output_control)  real-array HTupleSequence[float]HTupleHtuple (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

Result

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

Possible Predecessors

add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp, read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp, get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpGetSampleNumClassMlpget_sample_num_class_mlp

Possible Successors

classify_class_mlpclassify_class_mlpClassifyClassMlpClassifyClassMlpClassifyClassMlpclassify_class_mlp, evaluate_class_mlpevaluate_class_mlpEvaluateClassMlpEvaluateClassMlpEvaluateClassMlpevaluate_class_mlp

See also

create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp

Module

Foundation