示例#1
0
        public void TestHogOnAllNewDataWithPerformanceAndConfidence()
        {
            var folds = 5;

            for (int i = 0; i < folds; i++)
            {
                var allData  = ReadAllFiles(folds);
                var testData = allData[i];
                allData.RemoveAt(i);
                var data = Reading.MergeReadings(allData);

                Link.RenewalFactor = 0.000003; // maybe decrease
                Link.Step          = 0.05;
                var sut = new NeuralNet(2, 10, data.InputValues[0], data.ExpectedResults[0]);

                var iterations = sut.TrainAdaptiveWithConfidenceAndPerformance(data.InputValues, data.ExpectedResults, -0.00005, 1000000, testData);

                sut.PrintWeights(@"C:\Users\Serban\Pictures\20+\testData\OneLayertrainedOnData" + i + ".txt", iterations);
            }
        }
示例#2
0
文件: Tests.cs 项目: grozaserban/Leaf
        public void TestHogOnAllNewDataWithPerformanceAndConfidence(string dataPath)
        {
            var folds = 5;

            for (int i = 0; i < folds; i++)
            {
                var allData  = Reading.ReadAllFiles(dataPath, folds);
                var testData = allData[i];
                allData.RemoveAt(i);
                var data = Reading.MergeReadings(allData);

                Link.RenewalFactor = 0.000003; // maybe decrease
                Link.Step          = 0.05;
                var sut = NeuralNetFactory.Create(2,
                                                  10,
                                                  data.InputValues[0].Count,
                                                  data.ExpectedResults[0].Count);

                var iterations = sut.TrainAdaptiveWithConfidenceAndPerformance(data.InputValues, data.ExpectedResults, -0.00005, 150000, testData, i, dataPath);
            }
        }
示例#3
0
        public void TestHogOnAllNewData()
        {
            var testResultsPath = @"C:\Users\Serban\Pictures\20+\testData\zDataTestsPerformance.txt";
            var confidencePath  = @"C:\Users\Serban\Pictures\20+\testData\zDataTestsConfidence.txt";
            var folds           = 5;

            for (int i = 4; i < folds; i++)
            {
                var allData  = ReadAllFiles(folds);
                var testData = allData[i];
                allData.RemoveAt(i);
                var data = Reading.MergeReadings(allData);

                Link.RenewalFactor = 0.000003; // maybe decrease
                Link.Step          = 0.05;
                var sut = new NeuralNet(2, 10, data.InputValues[0], data.ExpectedResults[0]);

                var iterations = sut.TrainAdaptive(data.InputValues, data.ExpectedResults, -0.00005, 1000000);

                sut.PrintWeights(@"C:\Users\Serban\Pictures\20+\testData\trainedOnData" + i + ".txt", iterations);

                string results    = (i + 1).ToString() + " ";
                string confidence = (i + 1).ToString() + " ";

                for (int testSet = 0; testSet < testData.InputValues.Count; testSet++)
                {
                    sut.ChangeData(testData.InputValues[testSet], testData.ExpectedResults[testSet]);
                    results    += sut.CalculatePerformance() + " ";
                    confidence += sut.CalculateConfidence() + " ";
                }

                results    += Environment.NewLine;
                confidence += Environment.NewLine;

                File.AppendAllText(testResultsPath, results);
                File.AppendAllText(confidencePath, confidence);
            }
        }