Skip to content

create_class_train_dataCreateClassTrainDataCreateClassTrainDatacreate_class_train_dataT_create_class_train_data🔗

Short description🔗

create_class_train_dataCreateClassTrainDataCreateClassTrainDatacreate_class_train_dataT_create_class_train_data — Create a handle for training data for classifiers.

Signature🔗

create_class_train_data( number NumDim, out class_train_data ClassTrainDataHandle )void CreateClassTrainData( const HTuple& NumDim, HTuple* ClassTrainDataHandle )static void HOperatorSet.CreateClassTrainData( HTuple numDim, out HTuple classTrainDataHandle )def create_class_train_data( num_dim: int ) -> HHandle

Herror T_create_class_train_data( const Htuple NumDim, Htuple* ClassTrainDataHandle )

void HClassTrainData::HClassTrainData( Hlong NumDim )

public HClassTrainData( int numDim )

void HClassTrainData::CreateClassTrainData( Hlong NumDim )

void HClassTrainData.CreateClassTrainData( int numDim )

Description🔗

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

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

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🔗

NumDimnumDimnum_dim (input_control) number → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of dimensions of the feature vector.

Default: 1010

ClassTrainDataHandleclassTrainDataHandleclass_train_data_handle (output_control) class_train_data → (handle)HTuple (HHandle)HClassTrainData, HTuple (IntPtr)HHandleHtuple (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_dataCreateClassTrainData returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible successors

add_sample_class_knnAddSampleClassKnn, train_class_knnTrainClassKnn

Alternatives

create_class_svmCreateClassSvm, create_class_mlpCreateClassMlp

See also

select_feature_set_knnSelectFeatureSetKnn, read_class_knnReadClassKnn

Module🔗

Foundation