Operator Reference

get_sample_class_mlpT_get_sample_class_mlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp (Operator)

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_mlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp reads out a training sample from the multilayer perceptron (MLP) given by MLPHandleMLPHandleMLPHandleMLPHandlemlphandle that was added with add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp or read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp. The index of the sample is specified with IndexSampleIndexSampleIndexSampleindexSampleindex_sample. The index is counted from 0, i.e., IndexSampleIndexSampleIndexSampleindexSampleindex_sample must be a number between 0 and NumSamplesNumSamplesNumSamplesnumSamplesnum_samples - 1, where NumSamplesNumSamplesNumSamplesnumSamplesnum_samples can be determined with get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpget_sample_num_class_mlp. The training sample is returned in FeaturesFeaturesFeaturesfeaturesfeatures and TargetTargetTargettargettarget. FeaturesFeaturesFeaturesfeaturesfeatures is a feature vector of length NumInputNumInputNumInputnumInputnum_input, while TargetTargetTargettargettarget is a target vector of length NumOutputNumOutputNumOutputnumOutputnum_output (see add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp and create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpcreate_class_mlp).

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

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

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

MLP handle.

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

Number of stored training sample.

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

Feature vector of the training sample.

TargetTargetTargettargettarget (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_mlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp returns the value 2 ( H_MSG_TRUE) . If necessary, an exception is raised.

Possible Predecessors

add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp, read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp, get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpget_sample_num_class_mlp

Possible Successors

classify_class_mlpclassify_class_mlpClassifyClassMlpClassifyClassMlpclassify_class_mlp, evaluate_class_mlpevaluate_class_mlpEvaluateClassMlpEvaluateClassMlpevaluate_class_mlp

See also

create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpcreate_class_mlp

Module

Foundation