Пример #1
0
        public static void TrainElmhanNetwork(ref IExampleInterface app)
        {
            BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1], CONFIG.STARTING_YEAR,
                                                                       CONFIG.TRAIN_END,
                                                                       CONFIG.INPUT_WINDOW,
                                                                       CONFIG.PREDICT_WINDOW);

            //create our network.
            BasicNetwork network =
                (BasicNetwork)CreateEval.CreateElmanNetwork(CONFIG.INPUT_WINDOW, CONFIG.PREDICT_WINDOW);

            //Train it..

            double LastError = CreateEval.TrainNetworks(network, set);

            Console.WriteLine("NetWork Trained to :" + LastError);
            SuperUtils.SaveTraining(CONFIG.DIRECTORY, CONFIG.TRAINING_FILE, set);
            SuperUtils.SaveNetwork(CONFIG.DIRECTORY, CONFIG.NETWORK_FILE, network);
            Console.WriteLine("Network Saved to :" + CONFIG.DIRECTORY + " File Named :" +
                              CONFIG.NETWORK_FILE);

            Console.WriteLine("Training Saved to :" + CONFIG.DIRECTORY + " File Named :" +
                              CONFIG.TRAINING_FILE);
            MakeAPause();
        }
Пример #2
0
        public static void TrainSVMNetwork(ref IExampleInterface app)
        {
            //BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1],1000,500,CONFIG.INPUT_WINDOW,CONFIG.PREDICT_WINDOW);

            TemporalMLDataSet Tempo = CreateEval.GenerateATemporalSet(app.Args[1], 1000, 500, CONFIG.INPUT_WINDOW, CONFIG.PREDICT_WINDOW);

            SupportVectorMachine machine = createNetwork();

            //Train it..
            double error = TrainNetworks(machine, Tempo);

            Console.WriteLine(@"SVM NetWork Trained to :" + error);
            SuperUtils.SaveTraining(CONFIG.DIRECTORY, CONFIG.SVMTRAINING_FILE, Tempo);
            SuperUtils.SaveNetwork(CONFIG.DIRECTORY, CONFIG.SVMNETWORK_FILE, machine);

            Console.WriteLine(@"Network Saved to :" + CONFIG.DIRECTORY + @" File Named :" +
                              CONFIG.SVMNETWORK_FILE);
            Console.WriteLine(@"Training Saved to :" + CONFIG.DIRECTORY + @" File Named :" +
                              CONFIG.SVMTRAINING_FILE);
            MakeAPause();
        }
Пример #3
0
        /// <summary>
        /// Trains a random trainer.
        /// </summary>
        /// <param name="inputs">The inputs.</param>
        /// <param name="predictWindow">The predict window.</param>
        public static void RandomTrainerMethod(int inputs, int predictWindow)
        {
            double[]       firstinput   = MakeInputs(inputs);
            double[]       SecondInput  = MakeInputs(inputs);
            double[]       ThirdInputs  = MakeInputs(inputs);
            double[]       FourthInputs = MakeInputs(inputs);
            var            pair         = SuperUtils.ProcessPair(firstinput, FourthInputs, inputs, predictWindow);
            var            pair2        = SuperUtils.ProcessPair(SecondInput, FourthInputs, inputs, predictWindow);
            var            pair3        = SuperUtils.ProcessPair(ThirdInputs, FourthInputs, inputs, predictWindow);
            var            pair4        = SuperUtils.ProcessPair(FourthInputs, FourthInputs, inputs, predictWindow);
            BasicMLDataSet SuperSet     = new BasicMLDataSet();

            SuperSet.Add(pair);
            SuperSet.Add(pair2);
            SuperSet.Add(pair3);
            SuperSet.Add(pair4);
            var    network = (BasicNetwork)CreateEval.CreateElmanNetwork(SuperSet.InputSize, SuperSet.IdealSize);
            double error   = CreateEval.TrainNetworks(network, SuperSet);

            //Lets create an evaluation.
            Console.WriteLine(@"Last error rate on random trainer:" + error);
        }