Esempio n. 1
0
        internal static void backPropogationDemo()
        {
            try
            {
                DataSet              irisDataSet = DataSetFactory.getIrisDataSet();
                INumerizer           numerizer   = new IrisDataSetNumerizer();
                NeuralNetworkDataSet innds       = new IrisNeuralNetworkDataSet();

                innds.CreateExamplesFromDataSet(irisDataSet, numerizer);

                NeuralNetworkConfig config = new NeuralNetworkConfig();
                config.SetConfig(FeedForwardNeuralNetwork.NUMBER_OF_INPUTS, 4);
                config.SetConfig(FeedForwardNeuralNetwork.NUMBER_OF_OUTPUTS, 3);
                config.SetConfig(FeedForwardNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS,
                                 6);
                config.SetConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS, -2.0);
                config.SetConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, 2.0);

                FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(config);
                ffnn.SetTrainingScheme(new BackPropagationLearning(0.1, 0.9));

                ffnn.TrainOn(innds, 1000);

                innds.RefreshDataset();
                int[] result = ffnn.TestOnDataSet(innds);
                System.Console.WriteLine(result[0] + " right, " + result[1] + " wrong");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
        public void testDataSetPopulation()
        {
            DataSet              irisDataSet = DataSetFactory.getIrisDataSet();
            INumerizer           numerizer   = new IrisDataSetNumerizer();
            NeuralNetworkDataSet innds       = new IrisNeuralNetworkDataSet();

            innds.CreateExamplesFromDataSet(irisDataSet, numerizer);

            NeuralNetworkConfig config = new NeuralNetworkConfig();

            config.SetConfig(FeedForwardNeuralNetwork.NUMBER_OF_INPUTS, 4);
            config.SetConfig(FeedForwardNeuralNetwork.NUMBER_OF_OUTPUTS, 3);
            config.SetConfig(FeedForwardNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS, 6);
            config.SetConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS, -2.0);
            config.SetConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, 2.0);

            FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(config);

            ffnn.SetTrainingScheme(new BackPropagationLearning(0.1, 0.9));

            ffnn.TrainOn(innds, 10);

            innds.RefreshDataset();
            ffnn.TestOnDataSet(innds);
        }
Esempio n. 3
0
        public void testPerceptron()
        {
            DataSet              irisDataSet = DataSetFactory.getIrisDataSet();
            INumerizer           numerizer   = new IrisDataSetNumerizer();
            NeuralNetworkDataSet innds       = new IrisNeuralNetworkDataSet();

            innds.CreateExamplesFromDataSet(irisDataSet, numerizer);

            Perceptron perc = new Perceptron(3, 4);

            perc.TrainOn(innds, 10);

            innds.RefreshDataset();
            perc.TestOnDataSet(innds);
        }
Esempio n. 4
0
        internal static void backPropogationDeepLearningDemo()
        {
            try
            {
                System.Console.WriteLine(Util.ntimes("*", 100));
                System.Console.WriteLine(
                    "\n BackpropagationnDemo  - Running BackProp {1} hidden layers on Iris data Set with {0} epochs of learning ",
                    epochs, numHiddenLayers);
                System.Console.WriteLine(Util.ntimes("*", 100));

                DataSet              animalDataSet = DataSetFactory.getAnimalDataSet();
                INumerizer           numerizer     = new AnimalDataSetNumerizer();
                NeuralNetworkDataSet innds         = new IrisNeuralNetworkDataSet();

                innds.CreateExamplesFromDataSet(animalDataSet, numerizer);

                NeuralNetworkConfig config = new NeuralNetworkConfig();
                config.SetConfig(FeedForwardDeepNeuralNetwork.NUMBER_OF_INPUTS, 20);
                config.SetConfig(FeedForwardDeepNeuralNetwork.NUMBER_OF_OUTPUTS, 3);
                config.SetConfig(FeedForwardDeepNeuralNetwork.NUMBER_OF_HIDDEN_LAYERS, numHiddenLayers);
                config.SetConfig(FeedForwardDeepNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS_PER_LAYER, numNeuronsPerLayer);
                config.SetConfig(FeedForwardDeepNeuralNetwork.LOWER_LIMIT_WEIGHTS, -2.0);
                config.SetConfig(FeedForwardDeepNeuralNetwork.UPPER_LIMIT_WEIGHTS, 2.0);

                FeedForwardDeepNeuralNetwork ffnn = new FeedForwardDeepNeuralNetwork(config, new SoftSignActivationFunction());
                ffnn.SetTrainingScheme(new BackPropagationDeepLearning(0.1, 0.9));

                ffnn.TrainOn(innds, epochs);

                innds.RefreshDataset();
                int[] result = ffnn.TestOnDataSet(innds);
                System.Console.WriteLine(result[0] + " right, " + result[1] + " wrong");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 5
0
        static void perceptronDemo()
        {
            try
            {
                DataSet              irisDataSet = DataSetFactory.getIrisDataSet();
                INumerizer           numerizer   = new IrisDataSetNumerizer();
                NeuralNetworkDataSet innds       = new IrisNeuralNetworkDataSet();

                innds.CreateExamplesFromDataSet(irisDataSet, numerizer);

                Perceptron perc = new Perceptron(3, 4);

                perc.TrainOn(innds, 10);

                innds.RefreshDataset();
                int[] result = perc.TestOnDataSet(innds);
                System.Console.WriteLine(result[0] + " right, " + result[1] + " wrong");
            }
            catch (Exception e)
            {
                throw e;
            }
        }