trainAuto method
Trains the SVM with the optimal parameters found by a kFold cross-validation over the
grids, a grid left null uses getDefaultGrid.
balanced creates more balanced cross-validation subsets for 2-class classification.
Implementation
bool trainAuto(
TrainData data, {
int kFold = 10,
ParamGrid? Cgrid,
ParamGrid? gammaGrid,
ParamGrid? pGrid,
ParamGrid? nuGrid,
ParamGrid? coeffGrid,
ParamGrid? degreeGrid,
bool balanced = false,
}) {
final p = calloc<ffi.Bool>();
final grids = ParamGrid.allocateNative([Cgrid, gammaGrid, pGrid, nuGrid, coeffGrid, degreeGrid]);
try {
cvRun(
() => cml.cv_ml_SVM_trainAuto(
ref,
data.ref,
kFold,
grids[0],
grids[1],
grids[2],
grids[3],
grids[4],
grids[5],
balanced,
p,
ffi.nullptr,
),
);
return p.value;
} finally {
calloc.free(grids);
calloc.free(p);
}
}