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
dataTrainDatathe training data that can be constructed using TrainData::create or TrainData::loadFromCSV.
kFoldintCross-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.
cGridParamGrid?grid for C
gammaGridParamGrid?grid for gamma
pGridParamGrid?grid for p
nuGridParamGrid?grid for nu
coeffGridParamGrid?grid for coeff
degreeGridParamGrid?grid for degree
balancedboolIf 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.