public void Execute(IExampleInterface app)
        {
            this.app = app;
            FileInfo dataDir = new FileInfo(Environment.CurrentDirectory);
            if (String.Compare(app.Args[0], "sun", true) == 0)
            {

                SVMPredictSunSpots.PredictSunspotSVM.run();
                MakeAPause();
                app.Exit();
            }
            if (String.Compare(app.Args[0], "svm", true) == 0)
            {
                
               CreateSVMNetWork.Process(
               MLMethodFactory.TypeSVM,
               METHOD_SVMR_A,
               MLTrainFactory.TypeSVM,
               "", 1);
            }
            if (String.Compare(app.Args[0], "random", true) == 0)
            {
                if (app.Args.Length > 1)
                {
                    SVM_Predict.CreateSVMNetWork.RandomTrainerMethod(Convert.ToInt16(app.Args[1]), Convert.ToInt16(app.Args[2]));
                    MakeAPause();
                    app.Exit();
                }
                else
                {
                    Console.WriteLine(@"You didn't input enough args in your request, will default to 3000 inputs , and 50 prediction size");
                    SVM_Predict.CreateSVMNetWork.RandomTrainerMethod(3000, 1);
                    MakeAPause();
                    app.Exit();
                }

            }
        }
Beispiel #2
0
        public void Execute(IExampleInterface app)
        {
            this.app = app;
            FileInfo dataDir = new FileInfo(Environment.CurrentDirectory);

            if (String.Compare(app.Args[0], "randomtrainer", true) == 0)
            {
                if (app.Args.Length > 1)
                {
                    RandomTrainer.RandomTrainerMethod(Convert.ToInt16(app.Args[1]), Convert.ToInt16(app.Args[2]));
                    MakeAPause();
                    app.Exit();
                }
                else
                {
                    Console.WriteLine(@"You didn't input enough args in your request, will default to 3000 inputs , and 50 prediction size");
                    Console.WriteLine(@"Error % " + RandomTrainer.RandomTrainerMethod(3000, 50));
                }

                Console.ReadKey();
                return;
            }


            if (String.Compare(app.Args[0], "eval", true) == 0)
            {
                if (app.Args.Length > 0)
                {
                    //We have enough arguments, lets test them.
                    if (File.Exists(app.Args[1]))
                    {
                        BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1], CONFIG.EvalHowMany, CONFIG.EvalStartFrom, CONFIG.Inputs,
                                                                                   CONFIG.Outputs);

                        //create our network.
                        BasicNetwork network =
                            (BasicNetwork)NetworkUtility.LoadNetwork(CONFIG.DIRECTORY, CONFIG.NetWorkFile);
                        CreateEval.EvaluateNetworks(network, set);
                        MakeAPause();
                        return;
                    }
                }
            }



            if (String.Compare(app.Args[0], "prune", true) == 0)
            {
                //Start pruning.
                Console.WriteLine("Starting the pruning process....");

                Prunes.Incremental(new FileInfo(CONFIG.DIRECTORY), CONFIG.NetWorkFile,
                                   CONFIG.TrainingFile);

                MakeAPause();
                app.Exit();
            }
            if (String.Compare(app.Args[0], "train", true) == 0)
            {
                if (app.Args.Length > 0)
                {
                    //We have enough arguments, lets test them.
                    if (File.Exists(app.Args[1]))
                    {
                        //the file exits lets build the training.

                        //create our basic ml dataset.
                        BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1], CONFIG.HowMany, CONFIG.StartFrom, CONFIG.Inputs,
                                                                                   CONFIG.Outputs);

                        //create our network.
                        BasicNetwork network = (BasicNetwork)CreateEval.CreateElmanNetwork(CONFIG.Inputs, CONFIG.Outputs);

                        //Train it..

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

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

                        Console.WriteLine("Training Saved to :" + CONFIG.DIRECTORY + " File Named :" +
                                          CONFIG.TrainingFile);
                        MakeAPause();

                        app.Exit();
                        return;
                    }
                    else
                    {
                        Console.WriteLine("Couldnt find the file :" + app.Args[2].ToString());
                        Console.WriteLine("Exiting");
                        MakeAPause();
                        app.Exit();
                        return;
                    }
                }
            }
            else
            {
                Console.WriteLine("Couldnt understand your command..");
                Console.WriteLine(
                    "Valid commands are : RandomTrainer or Randomtrainer [inputs] [output] , or Train [File]");
                Console.WriteLine(
                    "Valid commands are : Range Prune, to prune your network.");
                Console.WriteLine(
                    "Valid commands are : Range eval , to evaluate your network.");
                MakeAPause();
                app.Exit();
            }
        }
Beispiel #3
0
        public void Execute(IExampleInterface app)
        {
            this.app = app;
            FileInfo dataDir = new FileInfo(Environment.CurrentDirectory);

            if (String.Compare(app.Args[0], "randomtrainer", true) == 0)
            {
                if (app.Args.Length > 1)
                {
                    Encog.Examples.RangeandMarket.RandomTrainer.RandomTrainerMethod(Convert.ToInt16(app.Args[1]), Convert.ToInt16(app.Args[2]));
                   
                }
                else
                {
                    Console.WriteLine(@"You didn't input enough args in your request, will default to 3000 inputs , and 50 prediction size");
                    Encog.Examples.RangeandMarket.RandomTrainer.RandomTrainerMethod(3000, 50);
                    MakeAPause();
                }

            }


            if (String.Compare(app.Args[0], "eval", true) == 0)
            {
                if (app.Args.Length > 0)
                {
                    //We have enough arguments, lets test them.
                    if (File.Exists(app.Args[1]))
                    {

                        BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1], CONFIG.EvalHowMany, CONFIG.EvalStartFrom, CONFIG.Inputs,
                                                  CONFIG.Outputs);

                         //create our network.
                        BasicNetwork network =
                            (BasicNetwork) SuperUtils.LoadNetwork(CONFIG.DIRECTORY, CONFIG.NetWorkFile);
                        CreateEval.EvaluateNetworks(network, set);
                        MakeAPause();
                        app.Exit();
                    }


                }
            }



            if (String.Compare(app.Args[0], "prune", true) == 0)
            {

                //Start pruning.
                Console.WriteLine("Starting the pruning process....");

                Prunes.Incremental(new FileInfo(CONFIG.DIRECTORY), CONFIG.NetWorkFile,
                            CONFIG.TrainingFile);

                MakeAPause();
                app.Exit();


            }
            if (String.Compare(app.Args[0], "train", true) == 0)
            {
                if (app.Args.Length> 0)
                {
                    //We have enough arguments, lets test them.
                    if (File.Exists(app.Args[1]))
                    {
                        //the file exits lets build the training.

                        //create our basic ml dataset.
                       BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1], CONFIG.HowMany, CONFIG.StartFrom, CONFIG.Inputs,
                                                   CONFIG.Outputs);

                        //create our network.
                        BasicNetwork network = (BasicNetwork) CreateEval.CreateElmanNetwork(CONFIG.Inputs, CONFIG.Outputs);

                        //Train it..

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

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

                        Console.WriteLine("Training Saved to :" + CONFIG.DIRECTORY + " File Named :" +
                                         CONFIG.TrainingFile);
                        MakeAPause();


                    }
                    else
                    {
                        Console.WriteLine("Couldnt find the file :" + app.Args[2].ToString());
                        Console.WriteLine("Exiting");
                        MakeAPause();
                        app.Exit();
                    }
                }
            }
            else
            {
                Console.WriteLine("Couldnt understand your command..");
                Console.WriteLine(
                    "Valid commands are : RandomTrainer or Randomtrainer [inputs] [output] , or Train [File]");
                Console.WriteLine(
                   "Valid commands are : Range Prune, to prune your network.");
                Console.WriteLine(
                   "Valid commands are : Range eval , to evaluate your network.");
                    MakeAPause();
                app.Exit();
            }
           

        }