Iteration() public final méthode

Perform one training iteration.
public final Iteration ( ) : void
Résultat void
        public void TestSOM()
        {
            // create the training set
            IMLDataSet training = new BasicMLDataSet(
                SOMInput, null);

            // Create the neural network.
            var network = new SOMNetwork(4, 2) {Weights = new Matrix(MatrixArray)};

            var train = new BasicTrainSOM(network, 0.4,
                                          training, new NeighborhoodSingle()) {ForceWinner = true};
            int iteration = 0;

            for (iteration = 0; iteration <= 100; iteration++)
            {
                train.Iteration();
            }

            IMLData data1 = new BasicMLData(
                SOMInput[0]);
            IMLData data2 = new BasicMLData(
                SOMInput[1]);

            int result1 = network.Classify(data1);
            int result2 = network.Classify(data2);

            Assert.IsTrue(result1 != result2);
        }
        public void TestSOM2()
        {
            // create the training set
            IMLDataSet training = new BasicMLDataSet(
                SOMInput2, null);

            // Create the neural network.
            var network = new SOMNetwork(4,4);

            var train = new BasicTrainSOM(network, 0.01,
                                       training, new NeighborhoodSingle()) { ForceWinner = true };

            int iteration = 0;

            for (iteration = 0; iteration <= 1000; iteration++)
            {
                train.Iteration();
            }

            IMLData data1 = new BasicMLData(
                SOMInput2[2]);
            IMLData data2 = new BasicMLData(
                SOMInput2[0]);

            IMLData data3 = new BasicMLData(
               SOMInput2[1]);
            IMLData data4 = new BasicMLData(
                SOMInput2[3]);

            int result1 = network.Classify(data1);
            int result2 = network.Classify(data2);
            int result3 = network.Classify(data3);
            int result4 = network.Classify(data4);

            Console.WriteLine("Winner in someinput 2 "+network.Winner(new BasicMLData(SOMInput2[0])));

            Console.WriteLine("First  :" +result1);
            Console.WriteLine("Second "+result2);
            Console.WriteLine("Third  :" + result3);
            Console.WriteLine("Fourth " + result4);

            Assert.IsTrue(result1 != result2);

            train.TrainPattern(new BasicMLData(SOMInput2[2]));
            Console.WriteLine("After training pattern: " + network.Winner(new BasicMLData(SOMInput2[1])));

            var result = new SupportVectorMachine(4, SVMType.SupportVectorClassification, KernelType.Sigmoid);
            training = new BasicMLDataSet(
                SOMInput2, SOMInput2);
            SVMTrain trainsvm = new SVMTrain(result, training);

            trainsvm.Iteration(50);

            result1 = result.Classify(data1);

            result2 = result.Classify(data2);
            result3 = result.Classify(data3);
            result4 = result.Classify(data4);

            Console.WriteLine("SVM classification : EURUSD 1 :"+result1 + "  GBPUSD:"+result2 + " EURCHF :"+result3+  " EURJPY:"+result4 );
        }
        /// <summary>
        /// Uczy siec Kohonena z podanymi parametrami.
        /// </summary>
        /// <param name="learningRate">Początkowy współczynnik nauki.</param>
        /// <param name="learningChangeRate">Współczynnik zmiany współczynnika nauki</param>
        /// <param name="neighbourhoodRate">Początkowy współczynnik sąsiedztwa.</param>
        /// <param name="neighbourhoodChangeRate">Współczynnik zmiany współczynnika sąsiedztwa.</param>
        /// <param name="trainIterations">Na ilu przykladach przebiega nauka.</param>
        /// <param name="learningSet">Zbiór danych uczących.</param>
        public void Train(double learningRate, double learningChangeRate,
            double neighbourhoodRate, double neighbourhoodChangeRate,
            int trainIterations, InputDataSet learningSet)
        {
            var basicMlDataSet = new BasicMLDataSet(learningSet.InputSet, null);
            INeighborhoodFunction neighborhoodFunc =
                new KohonenNeighbourhoodFunction(neighbourhoodRate, rows, columns);
            var train = new BasicTrainSOM(network, learningRate, basicMlDataSet, neighborhoodFunc);
            IStrategy strategy = new KohonenTrainStrategy(learningChangeRate, neighbourhoodChangeRate);
            strategy.Init(train);
            train.Strategies.Add(strategy);

            train.Iteration(trainIterations);
            train.FinishTraining();
        }