public static double TrainNetworks(SupportVectorMachine network, MarketMLDataSet training)
        {
            // train the neural network
            SVMTrain trainMain = new SVMTrain(network, training);

            StopTrainingStrategy stop = new StopTrainingStrategy(0.0001, 200);
            trainMain.AddStrategy(stop);


            var sw = new Stopwatch();
            sw.Start();
            while (!stop.ShouldStop())
            {
                trainMain.PreIteration();


                trainMain.Iteration();
                trainMain.PostIteration();

                Console.WriteLine(@"Iteration #:" + trainMain.IterationNumber + @" Error:" + trainMain.Error);
            }
            sw.Stop();
            Console.WriteLine("SVM Trained in :" + sw.ElapsedMilliseconds + "For error:" + trainMain.Error + " Iterated:" + trainMain.IterationNumber);
            return trainMain.Error;
        }
 public static double TrainSVM(SVMTrain train, SupportVectorMachine machine)
 {
    
     StopTrainingStrategy stop = new StopTrainingStrategy(0.0001, 200);
     train.AddStrategy(stop);
     var sw = new Stopwatch();
     sw.Start();
     while (!stop.ShouldStop())
     {
         train.PreIteration();
         
         train.Iteration();
         train.PostIteration();
         Console.WriteLine(@"Iteration #:" + train.IterationNumber + @" Error:" + train.Error +" Gamma:"+train.Gamma);
     }
     sw.Stop();
     Console.WriteLine(@"SVM Trained in :" + sw.ElapsedMilliseconds);
     return train.Error;
 }