示例#1
0
        public void PredictDiabetes()
        {
            /*
             * Create and train a neural network to predict if an individual has diabetes
             * among the pima indians.
             * The method print out the prediction error to the console for the training and
             * validation set to demonstrate how the network improve
             */
            FeedForwardNeuralNetwork network = new FeedForwardNeuralNetwork(NUMBER_OF_INPUTS, NUMBER_OF_OUTPUTS, NEURONS_IN_LAYER);

            for (int i = 0; i < 80000; i++)
            {
                //Train network on trainingset
                network.Train(permuteData('t'));

                //Print error of trainingset
                network.PrintAccuracy(permuteData('t')); //Root-mean-square-error
                //Measure error of validationset
            }
        } //improve method! for example: visualize the learning, quit training before overfitting etc.
示例#2
0
        public void PredictDiabetes()
        {
            /*
             * Create and train a neural network to predict if an individual has diabetes
             * among the pima indians.
             * The method print out the prediction error to the console for the training and
             * validation set to demonstrate how the network improve
             */
            FeedForwardNeuralNetwork network = new FeedForwardNeuralNetwork(NUMBER_OF_INPUTS, NUMBER_OF_OUTPUTS, NEURONS_IN_LAYER);

            for (int i = 0; i < 8000; i++)
            {
                //Train network on trainingset
                network.Train(getStochasticData(this.trainingset.Count, 't'));
                //Print error of trainingset
                Console.WriteLine("Total error (trainingset): ");
                network.PrintTotalError(getStochasticData(this.trainingset.Count, 't'));
                //Measure error of validationset
            }
        } //improve method! for example: visualize the learning, quit training before overfitting etc.