Package org.encog.neural.networks

Examples of org.encog.neural.networks.BasicNetwork


    public BasicNetwork network;
    private NeuralDataSet trainingData;

    public NeuralNetwork() {
        network = new BasicNetwork();
    }
View Full Code Here


  public final File EG_FILENAME = TEMP_DIR.createFile("encogtest.eg");
  public final File SERIAL_FILENAME = TEMP_DIR.createFile("encogtest.ser");
   
  public BasicNetwork create()
  {
    BasicNetwork network = XOR.createTrainedXOR();
    XOR.verifyXOR(network, 0.1);
   
    network.setProperty("test", "test2");

   
    return network;
  }
View Full Code Here

    XOR.verifyXOR(network, 0.1);
  }
 
  public void testPersistEG()
  {
    BasicNetwork network = create();

    EncogDirectoryPersistence.saveObject(EG_FILENAME, network);
    BasicNetwork network2 = (BasicNetwork)EncogDirectoryPersistence.loadObject(EG_FILENAME);

    validate(network2);
  }
View Full Code Here

    validate(network2);
  }
 
  public void testPersistSerial() throws IOException, ClassNotFoundException
  {
    BasicNetwork network = create();
   
    SerializeObject.save(SERIAL_FILENAME, network);
    BasicNetwork network2 = (BasicNetwork)SerializeObject.load(SERIAL_FILENAME);
       
    validate(network2);
  }
View Full Code Here

  public final File EG_FILENAME = TEMP_DIR.createFile("encogtest.eg");
  public final File SERIAL_FILENAME = TEMP_DIR.createFile("encogtest.ser");

  public void testRPROPCont() {
    MLDataSet trainingSet = XOR.createXORDataSet();
    BasicNetwork net1 = XOR.createUnTrainedXOR();
    BasicNetwork net2 = XOR.createUnTrainedXOR();
   
    ResilientPropagation rprop1 = new ResilientPropagation(net1,trainingSet);
    ResilientPropagation rprop2 = new ResilientPropagation(net2,trainingSet);
   
    rprop1.iteration();
    rprop1.iteration();
   
    rprop2.iteration();
    rprop2.iteration();
   
    TrainingContinuation cont = rprop2.pause();
   
    ResilientPropagation rprop3 = new ResilientPropagation(net2,trainingSet);
    rprop3.resume(cont);
   
    rprop1.iteration();
    rprop3.iteration();
   
   
    for(int i=0;i<net1.getFlat().getWeights().length;i++) {
      Assert.assertEquals(net1.getFlat().getWeights()[i], net2.getFlat().getWeights()[i],0.0001);
    }
  }
View Full Code Here

    }
  }
 
  public void testRPROPContPersistEG() {
    MLDataSet trainingSet = XOR.createXORDataSet();
    BasicNetwork net1 = XOR.createUnTrainedXOR();
    BasicNetwork net2 = XOR.createUnTrainedXOR();
   
    ResilientPropagation rprop1 = new ResilientPropagation(net1,trainingSet);
    ResilientPropagation rprop2 = new ResilientPropagation(net2,trainingSet);
   
    rprop1.iteration();
    rprop1.iteration();
   
    rprop2.iteration();
    rprop2.iteration();
   
    TrainingContinuation cont = rprop2.pause();
   
    EncogDirectoryPersistence.saveObject(EG_FILENAME, cont);
    TrainingContinuation cont2 = (TrainingContinuation)EncogDirectoryPersistence.loadObject(EG_FILENAME);
   
    ResilientPropagation rprop3 = new ResilientPropagation(net2,trainingSet);
    rprop3.resume(cont2);
   
    rprop1.iteration();
    rprop3.iteration();
   
   
    for(int i=0;i<net1.getFlat().getWeights().length;i++) {
      Assert.assertEquals(net1.getFlat().getWeights()[i], net2.getFlat().getWeights()[i],0.0001);
    }
  }
View Full Code Here

  public void run()
  {

    generateTraining();
   
    BasicNetwork ffNetwork = createFeedForward()
    BasicNetwork jordanNetwork = createJordan();
   
    MLDataSet trainingSet = new BasicMLDataSet(this.input, this.ideal);
   
    // train the neural network
    EncogUtility.trainConsole( jordanNetwork, trainingSet, 1);
    EncogUtility.trainConsole( ffNetwork, trainingSet, 1);
   
    System.out.println("Final Jordan Error: " + Format.formatPercent(jordanNetwork.calculateError(trainingSet)));
    System.out.println("Final Feedforwd Error: " + Format.formatPercent(jordanNetwork.calculateError(trainingSet)));
   
    System.out.println("However, the error rate can be misleading.  Consider the evaluations of each network.");
   
    System.out.println("Feedforward Evaluation:");
    EncogUtility.evaluate(ffNetwork, trainingSet);
View Full Code Here

    ErrorCalculation.setMode(ErrorCalculationMode.RMS);
   
    final TemporalXOR temp = new TemporalXOR();
    final MLDataSet trainingSet = temp.generate(120);

    final BasicNetwork jordanNetwork = JordanXOR.createJordanNetwork();
    final BasicNetwork feedforwardNetwork = JordanXOR
        .createFeedforwardNetwork();

    final double jordanError = JordanXOR.trainNetwork("Jordan", jordanNetwork,
        trainingSet);
    final double feedforwardError = JordanXOR.trainNetwork("Feedforward",
View Full Code Here

   */
  @Override
  public final MLMethod generate() {
    BasicLayer hidden, input;

    final BasicNetwork network = new BasicNetwork();
    network.addLayer(input = new BasicLayer(this.activation, true,
        this.inputNeurons));
    network.addLayer(hidden = new BasicLayer(this.activation, true,
        this.hiddenNeurons));
    network.addLayer(new BasicLayer(null, false, this.outputNeurons));
    input.setContextFedBy(hidden);
    network.getStructure().finalizeStructure();
    network.reset();
    return network;
  }
View Full Code Here

  @Override
  public final MLMethod generate() {

    BasicLayer hidden, output;

    final BasicNetwork network = new BasicNetwork();
    network.addLayer(new BasicLayer(null, true,
        this.inputNeurons));
    network.addLayer(hidden = new BasicLayer(this.activation, true,
        this.hiddenNeurons));
    network.addLayer(output = new BasicLayer(this.activation, false,
        this.outputNeurons));
    hidden.setContextFedBy(output);
    network.getStructure().finalizeStructure();
    network.reset();
    return network;
  }
View Full Code Here

TOP

Related Classes of org.encog.neural.networks.BasicNetwork

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.