Package org.neuroph.nnet

Examples of org.neuroph.nnet.Hopfield


        trainingSet.addElement(new TrainingElement(new double[]{1, 1, 1,
                                                                0, 1, 0,
                                                                0, 1, 0})); // T letter
 
        // create hopfield network
        Hopfield myHopfield = new Hopfield(9);
        // learn the training set
        myHopfield.learnInSameThread(trainingSet);

        // test hopfield network
        System.out.println("Testing network");

        // add one more 'incomplete' H pattern for testing - it will be recognized as H
        trainingSet.addElement(new TrainingElement(new double[]{1, 0, 0,
                                                                1, 0, 1,
                                                                1, 0, 1}));


        // print network output for the each element from the specified training set.
        for(TrainingElement trainingElement : trainingSet.trainingElements()) {
            myHopfield.setInput(trainingElement.getInput());
            myHopfield.calculate();
            myHopfield.calculate();  
            double[] networkOutput = myHopfield.getOutput();

            System.out.print("Input: " + Arrays.toString(trainingElement.getInput()) );
            System.out.println(" Output: " + Arrays.toString(networkOutput) );
        }
View Full Code Here


   * Creates and returns a new instance of Hopfield network
   * @param neuronsCount number of neurons in Hopfield network
   * @return instance of Hopfield network
   */
  public static Hopfield createHopfield(int neuronsCount) {
    Hopfield nnet = new Hopfield(neuronsCount);
    return nnet;
  }
View Full Code Here

TOP

Related Classes of org.neuroph.nnet.Hopfield

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.