Package org.neuroph.core.learning

Examples of org.neuroph.core.learning.TrainingElement


     */
    public static void main(String args[]) {

        // create training set (H and T letter in 3x3 grid)
        TrainingSet trainingSet = new TrainingSet();
        trainingSet.addElement(new TrainingElement(new double[]{1, 0, 1,
                                                                1, 1, 1,
                                                                1, 0, 1})); // H letter
       
        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.
View Full Code Here


                    outputs.add(values[j]);
                }
                if (outputsCount > 0) {
                    trainingSet.addElement(new SupervisedTrainingElement(inputs, outputs));
                } else {
                    trainingSet.addElement(new TrainingElement(inputs));
                }
            }
        }
        return trainingSet;
    }
View Full Code Here

        trainingSet.addElement(new SupervisedTrainingElement(new double[]{4187.0D / daxmax, 4223.0D / daxmax, 4259.0D / daxmax, 4203.0D / daxmax}, new double[]{3989.0D / daxmax}));
        neuralNet.learnInSameThread(trainingSet);
        System.out.println("Time stamp N2:" + new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss:MM").format(new Date()));

        TrainingSet testSet = new TrainingSet();
        testSet.addElement(new TrainingElement(new double[]{4223.0D / daxmax, 4259.0D / daxmax, 4203.0D / daxmax, 3989.0D / daxmax}));

        for (TrainingElement testElement : testSet.trainingElements()) {
            neuralNet.setInput(testElement.getInput());
            neuralNet.calculate();
            double[] networkOutput = neuralNet.getOutput();
View Full Code Here

          outputs[i] = Double.parseDouble(values[inputsCount + i]);

        if (outputsCount>0) {
              trainingSet.addElement(new SupervisedTrainingElement(inputs, outputs));
        } else {
              trainingSet.addElement(new TrainingElement(inputs));
        }
      }

      return trainingSet;
     
View Full Code Here

        Neuron nj = hopfieldLayer.getNeuronAt(j);
        Connection cij = nj.getConnectionFrom(ni);
        Connection cji = ni.getConnectionFrom(nj);
        double w = 0;
        for (int k = 0; k < M; k++) {
          TrainingElement trainingElement = trainingSet.elementAt(k);
          double pki = trainingElement.getInput()[i];
          double pkj = trainingElement.getInput()[j];
          w = w + pki * pkj;
        } // k
        cij.getWeight().setValue(w);
        cji.getWeight().setValue(w);
      } // j
View Full Code Here

               
    for (int phase = 0; phase < 2; phase++) {
      for (int k = 0; k < iterations[phase]; k++) {
        Iterator<TrainingElement> e = trainingSet.iterator();
        while (e.hasNext() && !isStopped()) {
          TrainingElement tE = e.next();
          learnPattern(tE, nR[phase]);       
        } // while
        currentIteration = k;
        this.notifyChange()
        if (isStopped()) return;
View Full Code Here

TOP

Related Classes of org.neuroph.core.learning.TrainingElement

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.