create_class_train_dataT_create_class_train_dataCreateClassTrainDataCreateClassTrainData (Operator)

Name

create_class_train_dataT_create_class_train_dataCreateClassTrainDataCreateClassTrainData — Create a handle for training data for classifiers.

Signature

create_class_train_data( : : NumDim : ClassTrainDataHandle)

Herror T_create_class_train_data(const Htuple NumDim, Htuple* ClassTrainDataHandle)

void CreateClassTrainData(const HTuple& NumDim, HTuple* ClassTrainDataHandle)

void HClassTrainData::HClassTrainData(Hlong NumDim)

void HClassTrainData::CreateClassTrainData(Hlong NumDim)

static void HOperatorSet.CreateClassTrainData(HTuple numDim, out HTuple classTrainDataHandle)

public HClassTrainData(int numDim)

void HClassTrainData.CreateClassTrainData(int numDim)

Description

create_class_train_datacreate_class_train_dataCreateClassTrainDataCreateClassTrainDataCreateClassTrainData creates a handle for training data for classifiers. The handle is returned in ClassTrainDataHandleClassTrainDataHandleClassTrainDataHandleClassTrainDataHandleclassTrainDataHandle. The dimension of the feature vectors is specified with NumDimNumDimNumDimNumDimnumDim. Only feature vectors of this length can be added to the handle.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

NumDimNumDimNumDimNumDimnumDim (input_control)  number HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of dimensions of the feature vector.

Default value: 10

ClassTrainDataHandleClassTrainDataHandleClassTrainDataHandleClassTrainDataHandleclassTrainDataHandle (output_control)  class_train_data HClassTrainData, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the training data.

Example (HDevelop)

* Find out which of the two features distinguishes two Classes
NameFeature1 := 'Good Feature'
NameFeature2 := 'Bad Feature'
LengthFeature1 := 3
LengthFeature2 := 2
* Create training data
create_class_train_data (LengthFeature1+LengthFeature2,\
  ClassTrainDataHandle)
* Define the features which are in the training data
set_feature_lengths_class_train_data (ClassTrainDataHandle, [LengthFeature1,\
  LengthFeature2], [NameFeature1, NameFeature2])
* Add training data
*                                                         |Feat1| |Feat2|
add_sample_class_train_data (ClassTrainDataHandle, 'row', [1,1,1,  2,1  ], 0)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [2,2,2,  2,1  ], 1)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [1,1,1,  3,4  ], 0)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [2,2,2,  3,4  ], 1)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [0,0,1,  5,6  ], 0)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [2,3,2,  5,6  ], 1)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [0,0,1,  5,6  ], 0)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [2,3,2,  5,6  ], 1)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [0,0,1,  5,6  ], 0)
add_sample_class_train_data (ClassTrainDataHandle, 'row', [2,3,2,  5,6  ], 1)
* Add more data 
* ...
* Select the better feature with the classifier of your choice
select_feature_set_knn (ClassTrainDataHandle, 'greedy', [], [], KNNHandle,\
  SelectedFeature, Score)
select_feature_set_svm (ClassTrainDataHandle, 'greedy', [], [], SVMHandle,\
  SelectedFeature, Score)
select_feature_set_mlp (ClassTrainDataHandle, 'greedy', [], [], MLPHandle,\
  SelectedFeature, Score)
select_feature_set_gmm (ClassTrainDataHandle, 'greedy', [], [], GMMHandle,\
  SelectedFeature, Score)
* Use the classifier
* ...

Result

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

Possible Successors

add_sample_class_knnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnnAddSampleClassKnn, train_class_knntrain_class_knnTrainClassKnnTrainClassKnnTrainClassKnn

Alternatives

create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm, create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlp

See also

select_feature_set_knnselect_feature_set_knnSelectFeatureSetKnnSelectFeatureSetKnnSelectFeatureSetKnn, read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnn

Module

Foundation