Table of Contents

Method TrainAuto

Namespace
OpenCvSharp.ML
Assembly
OpenCvSharp.dll

TrainAuto(TrainData, int, ParamGrid?, ParamGrid?, ParamGrid?, ParamGrid?, ParamGrid?, ParamGrid?, bool)

Trains an %SVM with optimal parameters.

public bool TrainAuto(TrainData data, int kFold = 10, ParamGrid? cGrid = null, ParamGrid? gammaGrid = null, ParamGrid? pGrid = null, ParamGrid? nuGrid = null, ParamGrid? coeffGrid = null, ParamGrid? degreeGrid = null, bool balanced = false)

Parameters

data TrainData

the training data that can be constructed using TrainData::create or TrainData::loadFromCSV.

kFold int

Cross-validation parameter. The training set is divided into kFold subsets. One subset is used to test the model, the others form the train set. So, the %SVM algorithm is executed kFold times.

cGrid ParamGrid?

grid for C

gammaGrid ParamGrid?

grid for gamma

pGrid ParamGrid?

grid for p

nuGrid ParamGrid?

grid for nu

coeffGrid ParamGrid?

grid for coeff

degreeGrid ParamGrid?

grid for degree

balanced bool

If true and the problem is 2-class classification then the method creates more balanced cross-validation subsets that is proportions between classes in subsets are close to such proportion in the whole train dataset.

Returns

bool