Package org.encog.neural.pattern

Examples of org.encog.neural.pattern.FeedForwardPattern


 
 

  public BasicNetwork createFeedForward()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(this.input[0].length);
    pattern.setOutputNeurons(this.ideal[0].length);
    pattern.addHiddenLayer(8);
    pattern.setActivationFunction(new ActivationSigmoid());
    return (BasicNetwork)pattern.generate();
  }
View Full Code Here


    return (BasicNetwork)pattern.generate();
  }

  static BasicNetwork createFeedforwardNetwork() {
    // construct a feedforward type network
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setActivationFunction(new ActivationSigmoid());
    pattern.setInputNeurons(1);
    pattern.addHiddenLayer(2);
    pattern.setOutputNeurons(1);
    return (BasicNetwork)pattern.generate();
  }
View Full Code Here

   * @return The neural network.
   */
  public static BasicNetwork simpleFeedForward(final int input,
      final int hidden1, final int hidden2, final int output,
      final boolean tanh) {
    final FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(input);
    pattern.setOutputNeurons(output);
    if (tanh) {
      pattern.setActivationFunction(new ActivationTANH());
    } else {
      pattern.setActivationFunction(new ActivationSigmoid());
    }

    if (hidden1 > 0) {
      pattern.addHiddenLayer(hidden1);
    }
    if (hidden2 > 0) {
      pattern.addHiddenLayer(hidden2);
    }

    final BasicNetwork network = (BasicNetwork)pattern.generate();
    network.reset();
    return network;
  }
View Full Code Here

    return (BasicNetwork)pattern.generate();
  }

  static BasicNetwork createFeedforwardNetwork() {
    // construct a feedforward type network
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setActivationFunction(new ActivationSigmoid());
    pattern.setInputNeurons(1);
    pattern.addHiddenLayer(6);
    pattern.setOutputNeurons(1);
    return (BasicNetwork)pattern.generate();
  }
View Full Code Here

    Assert.assertTrue(strategy.shouldStop());
  }
 
  public void testGreedy()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(1);
    pattern.setOutputNeurons(1);
    BasicNetwork network = (BasicNetwork)pattern.generate();
    MockTrain.setFirstElement(3.0,network);
   
    MockTrain mock = new MockTrain();
    mock.setNetwork(network);
    Greedy strategy = new Greedy();
View Full Code Here

    Assert.assertTrue(alt.wasUsed());
  }
 
  public void testReset()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(1);
    pattern.setOutputNeurons(1);
    BasicNetwork network = (BasicNetwork)pattern.generate();
   
    ResetStrategy strategy = new ResetStrategy(0.95,2);
    MockTrain mock = new MockTrain();
    mock.setNetwork(network);
    mock.addStrategy(strategy);
View Full Code Here

    Assert.assertTrue(MockTrain.getFirstElement(network)<20);
  }
 
  public void testSmart()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(1);
    pattern.setOutputNeurons(1);
    BasicNetwork network = (BasicNetwork)pattern.generate();
   
    SmartLearningRate strategy1 = new SmartLearningRate();
    SmartMomentum strategy2 = new SmartMomentum();
    MockTrain mock = new MockTrain();
    mock.setNetwork(network);
View Full Code Here

public class LunarLander {
 
  public static BasicNetwork createNetwork()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(3);
    pattern.addHiddenLayer(50);
    pattern.setOutputNeurons(1);
    pattern.setActivationFunction(new ActivationTANH());
    BasicNetwork network = (BasicNetwork)pattern.generate();
    network.reset();
    return network;
  }
View Full Code Here

      // decide if entire network is to be recreated
      if ((dialog.getActivationFunctionHidden() != oldActivationHidden)
          || (dialog.getActivationFunctionOutput() != oldActivationOutput)
          || dialog.getHidden().getModel().size() != (network
              .getLayerCount() - 2)) {
        FeedForwardPattern feedforward = new FeedForwardPattern();
        feedforward.setActivationFunction(dialog
            .getActivationFunctionHidden());
        feedforward.setInputNeurons(dialog.getInputCount().getValue());
        for (int i = 0; i < dialog.getHidden().getModel().size(); i++) {
          String str = (String) dialog.getHidden().getModel()
              .getElementAt(i);
          int i1 = str.indexOf(':');
          int i2 = str.indexOf("neur");
          if (i1 != -1 && i2 != -1) {
            str = str.substring(i1 + 1, i2).trim();
            int neuronCount = Integer.parseInt(str);
            feedforward.addHiddenLayer(neuronCount);
          }
        }
        feedforward.setInputNeurons(dialog.getInputCount().getValue());
        feedforward.setOutputNeurons(dialog.getOutputCount().getValue());
        BasicNetwork obj = (BasicNetwork) feedforward.generate();
      } else {
        // try to prune it
        PruneSelective prune = new PruneSelective(network);
        int newInputCount = dialog.getInputCount().getValue();
        int newOutputCount = dialog.getOutputCount().getValue();
View Full Code Here

    return "NeuralNetwork";
  }
 
  public void jsFunction_createFeedForward(int input, int hidden1, int hidden2, int output, String activation)
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
    pattern.setInputNeurons(input);
    pattern.setOutputNeurons(output);
   
    if( hidden1>0 )
      pattern.addHiddenLayer(hidden1);
    if( hidden2>0 )
      pattern.addHiddenLayer(hidden2);
   
    if( activation.equalsIgnoreCase("sigmoid") )
      pattern.setActivationFunction(new ActivationSigmoid());
    else if( activation.equalsIgnoreCase("tanh") )
      pattern.setActivationFunction(new ActivationSigmoid());
    else if( activation.equalsIgnoreCase("linear") )
      pattern.setActivationFunction(new ActivationSigmoid());
    else
      throw new EncogScriptError("Uknown activation type: " + activation);
   
    this.network = pattern.generate();
  }
View Full Code Here

TOP

Related Classes of org.encog.neural.pattern.FeedForwardPattern

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.