public override void TrainNetwork() { IMLTrain train = new SVMSearchTrain(Svm, TrainingSet); var iteration = 1; var errors = new List<double[]>(); do { train.Iteration(); errors.Add(new[] { -1, iteration, train.Error }); Console.WriteLine(@"Iteration #" + iteration++ + @" Training error:" + train.Error); } while ((iteration < Parameters.IterationsCount) && (train.Error > Parameters.AcceptedError)); train.FinishTraining(); ErrorSet = errors.ToArray(); }
public static SupportVectorMachine SVMSearch(SupportVectorMachine anetwork, IMLDataSet training) { SVMSearchTrain bestsearch = new SVMSearchTrain(anetwork, training); StopTrainingStrategy stop = new StopTrainingStrategy(0.00000000001, 1); bestsearch.AddStrategy(stop); while (bestsearch.IterationNumber < 30 && !stop.ShouldStop()) { bestsearch.Iteration(); Console.WriteLine("Iteration #" + bestsearch.IterationNumber + " Error :" + bestsearch.Error); } bestsearch.FinishTraining(); return anetwork; }