public void Process()
        {
            this.network = NetworkUtil.CreateNetwork();
            Console.WriteLine("Preparing training sets...");
            this.common = new CommonWords(Config.FILENAME_COMMON_WORDS);
            this.histogramGood = new WordHistogram(this.common);
            this.histogramBad = new WordHistogram(this.common);

            // load the good words
            this.histogramGood.BuildFromFile(Config.FILENAME_GOOD_TRAINING_TEXT);
            this.histogramGood.BuildComplete();

            // load the bad words
            this.histogramBad.BuildFromFile(Config.FILENAME_BAD_TRAINING_TEXT);
            this.histogramBad.BuildComplete();

            // remove low scoring words
            this.histogramGood
                    .RemoveBelow((int)this.histogramGood.CalculateMean());
            this.histogramBad.RemovePercent(0.99);

            // remove common words
            this.histogramGood.RemoveCommon(this.histogramBad);

            this.histogramGood.Trim(Config.INPUT_SIZE);

            this.goodAnalysis = new AnalyzeSentences(this.histogramGood,
                    Config.INPUT_SIZE);
            this.badAnalysis = new AnalyzeSentences(this.histogramGood,
                    Config.INPUT_SIZE);

            this.goodAnalysis.Process(this.trainingSet, 0.9,
                    Config.FILENAME_GOOD_TRAINING_TEXT);
            this.badAnalysis.Process(this.trainingSet, 0.1,
                    Config.FILENAME_BAD_TRAINING_TEXT);

            this.sampleCount = this.trainingSet.Ideal.Count;
            Console.WriteLine("Processing " + this.sampleCount + " training sets.");

            AllocateTrainingSets();

            CopyTrainingSets();

            TrainNetworkBackpropBackprop();
            SerializeObject.Save(Config.FILENAME_WHENBORN_NET, this.network);
            SerializeObject.Save(Config.FILENAME_HISTOGRAM, this.histogramGood);
            Console.WriteLine("Training complete.");

        }
 public TrainBot()
 {
     this.common = new CommonWords(Config.FILENAME_COMMON_WORDS);
     this.trainingSet = new TrainingSet();
 }
Example #3
0
 public WordHistogram(CommonWords common)
 {
     this.common = common;
 }