Esempio n. 1
0
        public static void Run()
        {
            var training = EncogUtility.LoadEGB2Memory(Config.TrainingFile);


            var pattern = new FeedForwardPattern
            {
                InputNeurons       = training.InputSize,
                OutputNeurons      = training.IdealSize,
                ActivationFunction = new ActivationTANH()
            };

            var prune = new PruneIncremental(training, pattern, 100, 1, 10,
                                             new ConsoleStatusReportable());

            prune.AddHiddenLayer(5, 50);
            prune.AddHiddenLayer(0, 50);

            Console.WriteLine("Starting prune process");

            prune.Process();

            EncogDirectoryPersistence.SaveObject(Config.NetworkFile, prune.BestNetwork);
            EncogUtility.SaveEGB(Config.TrainingFile, prune.Training);
        }
        public static void Incremental(FileInfo dataDir)
        {
            FileInfo file = FileUtil.CombinePath(dataDir, Config.TRAINING_FILE);

            if (!file.Exists)
            {
                Console.WriteLine(@"Can't read file: " + file);
                return;
            }

            IMLDataSet training = EncogUtility.LoadEGB2Memory(file);


            var pattern = new FeedForwardPattern
            {
                InputNeurons       = training.InputSize,
                OutputNeurons      = training.IdealSize,
                ActivationFunction = new ActivationTANH()
            };

            var prune = new PruneIncremental(training, pattern, 100, 1, 10,
                                             new ConsoleStatusReportable());

            prune.AddHiddenLayer(5, 50);
            prune.AddHiddenLayer(0, 50);

            prune.Process();

            EncogDirectoryPersistence.SaveObject(file, prune.BestNetwork);
        }
Esempio n. 3
0
        public static void Run()
        {
            Log("Loading training data");

            var encog       = new EncogPersistedCollection("market-training.dat", FileMode.Open);
            var trainingSet = (BasicMLDataSet)encog.Find("market-training");

            Log("Figuring out best system");

            var pattern = new FeedForwardPattern
            {
                InputNeurons       = trainingSet.InputSize,
                OutputNeurons      = trainingSet.IdealSize,
                ActivationFunction = new ActivationTANH()
            };

            var prune = new PruneIncremental(trainingSet, pattern, 100, new ConsoleStatusReportable());

            prune.AddHiddenLayer(1, 50);
            prune.AddHiddenLayer(0, 50);

            prune.Process();

            Log("Done!!!!");
        }
Esempio n. 4
0
    public void Prune()
    {
      INeuralDataSet trainingSet = new BasicNeuralDataSet(networkInput, networkIdealOutput);
      FeedForwardPattern pattern = new FeedForwardPattern();
      pattern.InputNeurons = INPUT_NEURONS;
      pattern.OutputNeurons = OUTPUT_NEURONS;

      if (ACTIVIATION_FUNCTION == 1)
        pattern.ActivationFunction = new ActivationSigmoid();
      else if (ACTIVIATION_FUNCTION == 2)
        pattern.ActivationFunction = new ActivationTANH();
      else
        throw new System.Exception("Only 2 activation functions have been impletemented.");

      PruneIncremental prune = new PruneIncremental(trainingSet, pattern, 200, new ConsoleStatusReportable());

      prune.AddHiddenLayer(10, 40);
      prune.AddHiddenLayer(0, 30);

      prune.Process();

      network = prune.BestNetwork;

      Console.WriteLine("Prune process complete.");
    }
Esempio n. 5
0
 void pruneWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     prune.Process();
 }