/// <summary> /// Perform either a train or a cross validation. If the folds property is /// greater than 1 then cross validation will be done. Cross validation does /// not produce a usable model, but it does set the error. /// If you are cross validating try C and Gamma values until you have a good /// error rate. Then use those values to train, producing the final model. /// </summary> /// public override sealed void Iteration() { _network.Params.C = _c; _network.Params.gamma = _gamma; EncogLogging.Log(EncogLogging.LevelInfo, "Training with parameters C = " + _c + ", gamma = " + _gamma); if (_fold > 1) { // cross validate var target = new double[_problem.l]; svm.svm_cross_validation(_problem, _network.Params, _fold, target); _network.Model = null; Error = Evaluate(_network.Params, _problem, target); } else { // train _network.Model = svm.svm_train(_problem, _network.Params); Error = _network.CalculateError(Training); } _trainingDone = true; }