Package org.neuroph.nnet

Examples of org.neuroph.nnet.Perceptron


            trainingSet.addElement(new SupervisedTrainingElement(new double[]{0, 1}, new double[]{0}));
            trainingSet.addElement(new SupervisedTrainingElement(new double[]{1, 0}, new double[]{0}));
            trainingSet.addElement(new SupervisedTrainingElement(new double[]{1, 1}, new double[]{1}));

            // create perceptron neural network
            NeuralNetwork myPerceptron = new Perceptron(2, 1);
            // learn the training set
            myPerceptron.learnInSameThread(trainingSet);
            // test perceptron
            System.out.println("Testing trained perceptron");
            testNeuralNetwork(myPerceptron, trainingSet);
            // save trained perceptron
            myPerceptron.save("mySamplePerceptron.nnet");
            // load saved neural network
            NeuralNetwork loadedPerceptron = NeuralNetwork.load("mySamplePerceptron.nnet");
            // test loaded neural network
            System.out.println("Testing loaded perceptron");
            testNeuralNetwork(loadedPerceptron, trainingSet);
View Full Code Here


         * @param outputNeuronsCount number of neurons in output layer
         * @param transferFunctionType type of transfer function to use
   * @return instance of Perceptron network
   */ 
  public static Perceptron createPerceptron(int inputNeuronsCount, int outputNeuronsCount, TransferFunctionType transferFunctionType) {
    Perceptron nnet = new Perceptron(inputNeuronsCount, outputNeuronsCount, transferFunctionType);
    return nnet;
  }
View Full Code Here

         * @param transferFunctionType type of transfer function to use
         * @param learningRule learning rule class
   * @return instance of Perceptron network
   */
  public static Perceptron createPerceptron(int inputNeuronsCount, int outputNeuronsCount, TransferFunctionType transferFunctionType, Class learningRule) {
    Perceptron nnet = new Perceptron(inputNeuronsCount, outputNeuronsCount, transferFunctionType);

                if (learningRule.getName().equals(PerceptronLearning.class.getName()))  {
                    nnet.setLearningRule(new PerceptronLearning());
                } else if (learningRule.getName().equals(BinaryDeltaRule.class.getName())) {
                    nnet.setLearningRule(new BinaryDeltaRule());
                }

    return nnet;
  }
View Full Code Here

TOP

Related Classes of org.neuroph.nnet.Perceptron

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.