public static void RunGHCNN() { foreach (string dataset in GetDatasetFolds("datasets.txt")) { //---------------------------------------- Console.WriteLine("Data Table:" + dataset); //---------------------------------------- double avgQualityBefore = 0; double avgSizeBefore = 0; double avgQulityAfter = 0; double avgSizeAfter = 0; for (_currentFold = 0; _currentFold < _folds; _currentFold++) { //---------------------------------------- Console.WriteLine("Fold:" + _currentFold.ToString()); //---------------------------------------- DataMining.Data.Dataset[] tables = LoadTrainingAndTestingData(dataset, _currentFold); DataMining.Data.Dataset trainingSet = tables[0]; DataMining.Data.Dataset testingSet = tables[1]; double quality_before = 0.0; double quality_final = 0.0; double size_before = 0.0; double size_final = 0.0; IClassificationMeasure testMeasure = new AccuracyMeasure(); ILearningMethod learningMethod = new BackPropagation(_acoLearningRateNW, _acoEpochsNW, 0.9, false); //int hiddenUnitCount = trainingSet.Metadata.Attributes.Length * trainingSet.Metadata.Target.Length; int hiddenUnitCount = (trainingSet.Metadata.Attributes.Length + trainingSet.Metadata.Target.Length); IActivationFunction activationFunction = new SigmoidActivationFunction(); IClassificationMeasure trainingMeasure = new QLFunction(); NNClassificationQualityEvaluator evaluator = new NNClassificationQualityEvaluator(trainingMeasure, learningMethod, hiddenUnitCount, activationFunction); NNConnectionHeuristicCalculator calculator = new NNConnectionHeuristicCalculator(0.7); DefaultRemovalLocalSearch <ConnectionDC> localSearch = new DefaultRemovalLocalSearch <ConnectionDC>(evaluator); NNConnectorInvalidator invalidator = new NNConnectorInvalidator(); Problem <ConnectionDC> problem = new Problem <ConnectionDC>(invalidator, calculator, evaluator, localSearch); NeuralNetwork network_before = null; try { stopWatch.Reset(); stopWatch.Start(); NeuralNetwork network_final = SingleTest.CreateNeuralNet_GHCNN(problem, hiddenUnitCount, true, false, trainingSet, ref network_before); stopWatch.Stop(); quality_before = SingleTest.TestClassifier(network_before, testingSet, testMeasure); quality_before = Math.Round(quality_before * 100, 2); avgQualityBefore += quality_before; quality_final = SingleTest.TestClassifier(network_final, testingSet, testMeasure); quality_final = Math.Round(quality_final * 100, 2); avgQulityAfter += quality_final; size_before = network_before.Size; size_final = network_final.Size; avgSizeBefore += size_before; avgSizeAfter += avgSizeAfter; //---------------------------------------- Console.WriteLine("GHCNN - before:" + dataset + "- Fold:" + _currentFold.ToString() + "=>" + testMeasure.ToString() + ":" + quality_before.ToString()); Console.WriteLine("GHCNN - final:" + dataset + "- Fold:" + _currentFold.ToString() + "=>" + testMeasure.ToString() + ":" + quality_final.ToString()); Console.WriteLine("---------------------------------------------------"); //---------------------------------------- } catch (Exception ex) { LogError(ex); break; } } avgQualityBefore /= _folds; avgQulityAfter /= _folds; avgSizeBefore /= _folds; avgSizeAfter /= _folds; SaveResults(dataset, "GHCNN - before", avgQualityBefore.ToString(), avgSizeBefore.ToString(), stopWatch.ElapsedMilliseconds.ToString()); SaveResults(dataset, "GHCNN - final", avgQulityAfter.ToString(), avgSizeAfter.ToString(), stopWatch.ElapsedMilliseconds.ToString()); Console.WriteLine("---------------------------------------------------"); Console.WriteLine("---------------------------------------------------"); Console.WriteLine("---------------------------------------------------"); } }