create_class_train_dataT_create_class_train_dataCreateClassTrainDataCreateClassTrainDatacreate_class_train_data (Operator)

Name

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

def create_class_train_data(num_dim: int) -> HHandle

Description

create_class_train_datacreate_class_train_dataCreateClassTrainDataCreateClassTrainDatacreate_class_train_data creates a handle for training data for classifiers. The handle is returned in ClassTrainDataHandleClassTrainDataHandleClassTrainDataHandleclassTrainDataHandleclass_train_data_handle. The dimension of the feature vectors is specified with NumDimNumDimNumDimnumDimnum_dim. 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

NumDimNumDimNumDimnumDimnum_dim (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of dimensions of the feature vector.

Default: 10

ClassTrainDataHandleClassTrainDataHandleClassTrainDataHandleclassTrainDataHandleclass_train_data_handle (output_control)  class_train_data HClassTrainData, HTupleHHandleHTupleHtuple (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_dataCreateClassTrainDataCreateClassTrainDatacreate_class_train_data returns the value 2 ( H_MSG_TRUE) . If necessary, an exception is raised.

Possible Successors

add_sample_class_knnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnnadd_sample_class_knn, train_class_knntrain_class_knnTrainClassKnnTrainClassKnntrain_class_knn

Alternatives

create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmcreate_class_svm, create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpcreate_class_mlp

See also

select_feature_set_knnselect_feature_set_knnSelectFeatureSetKnnSelectFeatureSetKnnselect_feature_set_knn, read_class_knnread_class_knnReadClassKnnReadClassKnnread_class_knn

Module

Foundation