Package aima.core.learning.neural

Examples of aima.core.learning.neural.FeedForwardNeuralNetwork


      config
          .setConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS,
              -2.0);
      config.setConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, 2.0);

      FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(config);
      ffnn.setTrainingScheme(new BackPropLearning(0.1, 0.9));

      ffnn.trainOn(innds, 10);

      innds.refreshDataset();
      int[] result = ffnn.testOnDataSet(innds);
      System.out.println(result[0] + " right, " + result[1] + " wrong");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


    Vector error = new Vector(1);
    error.setValue(0, 1.261);

    double learningRate = 0.1;
    double momentumFactor = 0.0;
    FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(
        hiddenLayerWeightMatrix, hiddenLayerBiasVector,
        outputLayerWeightMatrix, outputLayerBiasVector);
    ffnn.setTrainingScheme(new BackPropLearning(learningRate,
        momentumFactor));
    ffnn.processInput(input);
    ffnn.processError(error);

    Matrix finalHiddenLayerWeights = ffnn.getHiddenLayerWeights();
    Assert.assertEquals(-0.265, finalHiddenLayerWeights.get(0, 0), 0.001);
    Assert.assertEquals(-0.419, finalHiddenLayerWeights.get(1, 0), 0.001);

    Vector hiddenLayerBias = ffnn.getHiddenLayerBias();
    Assert.assertEquals(-0.475, hiddenLayerBias.getValue(0), 0.001);
    Assert.assertEquals(-0.1399, hiddenLayerBias.getValue(1), 0.001);

    Matrix finalOutputLayerWeights = ffnn.getOutputLayerWeights();
    Assert.assertEquals(0.171, finalOutputLayerWeights.get(0, 0), 0.001);
    Assert.assertEquals(-0.0772, finalOutputLayerWeights.get(0, 1), 0.001);

    Vector outputLayerBias = ffnn.getOutputLayerBias();
    Assert.assertEquals(0.7322, outputLayerBias.getValue(0), 0.001);
  }
View Full Code Here

    Vector error = new Vector(1);
    error.setValue(0, 1.261);

    double learningRate = 0.1;
    double momentumFactor = 0.5;
    FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(
        hiddenLayerWeightMatrix, hiddenLayerBiasVector,
        outputLayerWeightMatrix, outputLayerBiasVector);

    ffnn.setTrainingScheme(new BackPropLearning(learningRate,
        momentumFactor));
    ffnn.processInput(input);
    ffnn.processError(error);

    Matrix finalHiddenLayerWeights = ffnn.getHiddenLayerWeights();
    Assert.assertEquals(-0.2675, finalHiddenLayerWeights.get(0, 0), 0.001);
    Assert.assertEquals(-0.4149, finalHiddenLayerWeights.get(1, 0), 0.001);

    Vector hiddenLayerBias = ffnn.getHiddenLayerBias();
    Assert.assertEquals(-0.4775, hiddenLayerBias.getValue(0), 0.001);
    Assert.assertEquals(-0.1349, hiddenLayerBias.getValue(1), 0.001);

    Matrix finalOutputLayerWeights = ffnn.getOutputLayerWeights();
    Assert.assertEquals(0.1304, finalOutputLayerWeights.get(0, 0), 0.001);
    Assert.assertEquals(-0.1235, finalOutputLayerWeights.get(0, 1), 0.001);

    Vector outputLayerBias = ffnn.getOutputLayerBias();
    Assert.assertEquals(0.6061, outputLayerBias.getValue(0), 0.001);
  }
View Full Code Here

    config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_OUTPUTS, 3);
    config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS, 6);
    config.setConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS, -2.0);
    config.setConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, 2.0);

    FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(config);
    ffnn.setTrainingScheme(new BackPropLearning(0.1, 0.9));

    ffnn.trainOn(innds, 10);

    innds.refreshDataset();
    ffnn.testOnDataSet(innds);
  }
View Full Code Here

TOP

Related Classes of aima.core.learning.neural.FeedForwardNeuralNetwork

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.