コード例 #1
0
        public void testPerceptron()
        {
            DataSet irisDataSet = DataSetFactory.getIrisDataSet();
            Numerizer numerizer = new IrisDataSetNumerizer();
            NNDataSet innds = new IrisNNDataSet();

            innds.createExamplesFromDataSet(irisDataSet, numerizer);

            Perceptron perc = new Perceptron(3, 4);

            perc.trainOn(innds, 10);

            innds.refreshDataset();
            perc.testOnDataSet(innds);
        }
コード例 #2
0
        public void testDataSetPopulation()
        {
            DataSet irisDataSet = DataSetFactory.getIrisDataSet();
            Numerizer numerizer = new IrisDataSetNumerizer();
            NNDataSet innds = new IrisNNDataSet();

            innds.createExamplesFromDataSet(irisDataSet, numerizer);

            NNConfig config = new NNConfig();
            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 BackPropLearning(0.1, 0.9));

            ffnn.trainOn(innds, 10);

            innds.refreshDataset();
            ffnn.testOnDataSet(innds);
        }