Package org.encog.neural.networks.training.propagation.resilient

Examples of org.encog.neural.networks.training.propagation.resilient.ResilientPropagation


    BasicNetwork network1 = NetworkUtil.createXORNetworkUntrained();
    BasicNetwork network2 = NetworkUtil.createXORNetworkUntrained();
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    // train network 1, no continue
    ResilientPropagation rprop1 = new ResilientPropagation(network1,trainingData);
    rprop1.iteration();
    rprop1.iteration();
    rprop1.iteration();
    rprop1.iteration();
   
    // train network 2, continue
    ResilientPropagation rprop2 = new ResilientPropagation(network2,trainingData);
    rprop2.iteration();
    rprop2.iteration();
    TrainingContinuation state = rprop2.pause();
    rprop2 = new ResilientPropagation(network2,trainingData);
    rprop2.resume(state);
    rprop2.iteration();
    rprop2.iteration();
   
    // verify weights are the same
    double[] weights1 = NetworkCODEC.networkToArray(network1);
    double[] weights2 = NetworkCODEC.networkToArray(network2);
   
    Assert.assertEquals(rprop1.getError(), rprop2.getError(), 0.01);
    Assert.assertEquals(weights1.length, weights2.length);
    Assert.assertArrayEquals(weights1, weights2, 0.01);
   
  }
View Full Code Here


  {
    MLDataSet trainingData = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
   
    BasicNetwork network = EncogUtility.simpleFeedForward(2, 5, 7, 1, true);
    (new ConsistentRandomizer(-1,1)).randomize(network);
    MLTrain rprop = new ResilientPropagation(network, trainingData);
    int iteration = 0;
    do {
      rprop.iteration();
      iteration++;
    } while( iteration<5000 && rprop.getError()>0.01);
    Assert.assertTrue(iteration<40);
  }
View Full Code Here

    elmanPattern.setInputNeurons(input);
    elmanPattern.addHiddenLayer(hidden);
    elmanPattern.setOutputNeurons(ideal);
    BasicNetwork network = (BasicNetwork)elmanPattern.generate();
    MLDataSet training = RandomTrainingFactory.generate(1000, 5, network.getInputCount(), network.getOutputCount(), -1, 1);
    ResilientPropagation prop = new ResilientPropagation(network,training);
    prop.iteration();
    prop.iteration();   
  }
View Full Code Here

    jordanPattern.setInputNeurons(input);
    jordanPattern.addHiddenLayer(hidden);
    jordanPattern.setOutputNeurons(ideal);
    BasicNetwork network = (BasicNetwork)jordanPattern.generate();
    MLDataSet training = RandomTrainingFactory.generate(1000, 5, network.getInputCount(), network.getOutputCount(), -1, 1);
    ResilientPropagation prop = new ResilientPropagation(network,training);
    prop.iteration();
    prop.iteration();   
  }
View Full Code Here

public class ResilientPropagationFactory implements EnsembleTrainFactory {

  @Override
  public MLTrain getTraining(MLMethod mlMethod, MLDataSet trainingData) {
    return (MLTrain) new ResilientPropagation((BasicNetwork) mlMethod, trainingData);
  }
View Full Code Here

  public static int evaluateTrain(
      final BasicNetwork network, final MLDataSet training) {
    // train the neural network
    MLTrain train;
   
    train = new ResilientPropagation(network, training);

    final long start = System.currentTimeMillis();
    final long stop = start + (10 * MILIS);

    int iterations = 0;
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public void createTrainer(final boolean singleThreaded) {
    final Propagation train = new ResilientPropagation(getNetwork(),
        getTraining(), getInitialUpdate(), getMaxStep());

    if (singleThreaded) {
      train.setThreadCount(1);
    } else {
      train.setThreadCount(0);
    }

    for (final Strategy strategy : getStrategies()) {
      train.addStrategy(strategy);
    }

    setTrain(train);
  }
View Full Code Here

TOP

Related Classes of org.encog.neural.networks.training.propagation.resilient.ResilientPropagation

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.