add_sample_class_mlpT_add_sample_class_mlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp (Operator)

Name

add_sample_class_mlpT_add_sample_class_mlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp — Add a training sample to the training data of a multilayer perceptron.

Signature

add_sample_class_mlp( : : MLPHandle, Features, Target : )

Herror T_add_sample_class_mlp(const Htuple MLPHandle, const Htuple Features, const Htuple Target)

void AddSampleClassMlp(const HTuple& MLPHandle, const HTuple& Features, const HTuple& Target)

void HClassMlp::AddSampleClassMlp(const HTuple& Features, const HTuple& Target) const

void HClassMlp::AddSampleClassMlp(const HTuple& Features, Hlong Target) const

static void HOperatorSet.AddSampleClassMlp(HTuple MLPHandle, HTuple features, HTuple target)

void HClassMlp.AddSampleClassMlp(HTuple features, HTuple target)

void HClassMlp.AddSampleClassMlp(HTuple features, int target)

def add_sample_class_mlp(mlphandle: HHandle, features: Sequence[float], target: MaybeSequence[Union[int, float]]) -> None

Description

add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp adds a training sample to the multilayer perceptron (MLP) given by MLPHandleMLPHandleMLPHandleMLPHandleMLPHandlemlphandle. The training sample is given by FeaturesFeaturesFeaturesFeaturesfeaturesfeatures and TargetTargetTargetTargettargettarget. FeaturesFeaturesFeaturesFeaturesfeaturesfeatures is the feature vector of the sample, and consequently must be a real vector of length NumInputNumInputNumInputNumInputnumInputnum_input, as specified in create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp. TargetTargetTargetTargettargettarget is the target vector of the sample, which must have the length NumOutputNumOutputNumOutputNumOutputnumOutputnum_output (see create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp) for all three types of activation functions of the MLP (exception: see below). If the MLP is used for regression (function approximation), i.e., if OutputFunctionOutputFunctionOutputFunctionOutputFunctionoutputFunctionoutput_function = 'linear'"linear""linear""linear""linear""linear", TargetTargetTargetTargettargettarget is the value of the function at the coordinate FeaturesFeaturesFeaturesFeaturesfeaturesfeatures. In this case, TargetTargetTargetTargettargettarget can contain arbitrary real numbers. For OutputFunctionOutputFunctionOutputFunctionOutputFunctionoutputFunctionoutput_function = 'logistic'"logistic""logistic""logistic""logistic""logistic", TargetTargetTargetTargettargettarget can only contain the values 0.0 and 1.0. A value of 1.0 specifies that the attribute in question is present, while a value of 0.0 specifies that the attribute is absent. Because in this case the attributes are independent, arbitrary combinations of 0.0 and 1.0 can be passed. For OutputFunctionOutputFunctionOutputFunctionOutputFunctionoutputFunctionoutput_function = 'softmax'"softmax""softmax""softmax""softmax""softmax", TargetTargetTargetTargettargettarget also can only contain the values 0.0 and 1.0. In contrast to OutputFunctionOutputFunctionOutputFunctionOutputFunctionoutputFunctionoutput_function = 'logistic'"logistic""logistic""logistic""logistic""logistic", the value 1.0 must be present for exactly one element of the tuple TargetTargetTargetTargettargettarget. The location in the tuple designates the class of the sample. For ease of use, a single integer value may be passed if OutputFunctionOutputFunctionOutputFunctionOutputFunctionoutputFunctionoutput_function = 'softmax'"softmax""softmax""softmax""softmax""softmax". This value directly designates the class of the sample, which is counted from 0, i.e., the class must be an integer between 0 and NumOutputNumOutputNumOutputNumOutputnumOutputnum_output - 1. The class is converted to a target vector of length NumOutputNumOutputNumOutputNumOutputnumOutputnum_output internally.

Before the MLP can be trained with train_class_mlptrain_class_mlpTrainClassMlpTrainClassMlpTrainClassMlptrain_class_mlp, all training samples must be added to the MLP with add_sample_class_mlpadd_sample_class_mlpAddSampleClassMlpAddSampleClassMlpAddSampleClassMlpadd_sample_class_mlp.

The number of currently stored training samples can be queried with get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpGetSampleNumClassMlpget_sample_num_class_mlp. Stored training samples can be read out again with get_sample_class_mlpget_sample_class_mlpGetSampleClassMlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp.

Normally, it is useful to save the training samples in a file with write_samples_class_mlpwrite_samples_class_mlpWriteSamplesClassMlpWriteSamplesClassMlpWriteSamplesClassMlpwrite_samples_class_mlp to facilitate reusing the samples, and to facilitate that, if necessary, new training samples can be added to the data set, and hence to facilitate that a newly created MLP can be trained anew with the extended data set.

Execution Information

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters

MLPHandleMLPHandleMLPHandleMLPHandleMLPHandlemlphandle (input_control, state is modified)  class_mlp HClassMlp, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

MLP handle.

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

Feature vector of the training sample to be stored.

TargetTargetTargetTargettargettarget (input_control)  number(-array) HTupleMaybeSequence[Union[int, float]]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Class or target vector of the training sample to be stored.

Result

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

Possible Predecessors

create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlpcreate_class_mlp

Possible Successors

train_class_mlptrain_class_mlpTrainClassMlpTrainClassMlpTrainClassMlptrain_class_mlp, write_samples_class_mlpwrite_samples_class_mlpWriteSamplesClassMlpWriteSamplesClassMlpWriteSamplesClassMlpwrite_samples_class_mlp

Alternatives

read_samples_class_mlpread_samples_class_mlpReadSamplesClassMlpReadSamplesClassMlpReadSamplesClassMlpread_samples_class_mlp

See also

clear_samples_class_mlpclear_samples_class_mlpClearSamplesClassMlpClearSamplesClassMlpClearSamplesClassMlpclear_samples_class_mlp, get_sample_num_class_mlpget_sample_num_class_mlpGetSampleNumClassMlpGetSampleNumClassMlpGetSampleNumClassMlpget_sample_num_class_mlp, get_sample_class_mlpget_sample_class_mlpGetSampleClassMlpGetSampleClassMlpGetSampleClassMlpget_sample_class_mlp

Module

Foundation