Package org.neuroph.core

Examples of org.neuroph.core.Layer


    // init neuron settings for this type of network
    NeuronProperties neuronProperties = new NeuronProperties();
    neuronProperties.setProperty("transferFunction", TransferFunctionType.STEP);
   
    // create input layer
    Layer inputLayer = LayerFactory.createLayer(inputNeuronsCount, neuronProperties);
    this.addLayer(inputLayer);

    // createLayer output layer
    neuronProperties.setProperty("transferFunction", TransferFunctionType.STEP);
    Layer outputLayer = LayerFactory.createLayer(1,  neuronProperties);
    this.addLayer(outputLayer);

    // create full conectivity between input and output layer
    ConnectionFactory.fullConnect(inputLayer, outputLayer);
View Full Code Here


    // set network type
    this.setNetworkType(NeuralNetworkType.MULTI_LAYER_PERCEPTRON);

                // create input layer
                NeuronProperties inputNeuronProperties = new NeuronProperties(InputNeuron.class, TransferFunctionType.LINEAR);
                Layer layer = LayerFactory.createLayer(neuronsInLayers.get(0), inputNeuronProperties);

                boolean useBias = true; // use bias neurons by default
                if (neuronProperties.hasProperty("useBias")) {
                    useBias = (Boolean)neuronProperties.getProperty("useBias");
                }

                if (useBias) {
                    layer.addNeuron(new BiasNeuron());
                }

                this.addLayer(layer);

    // create layers
    Layer prevLayer = layer;

    //for(Integer neuronsNum : neuronsInLayers)
                for(int layerIdx = 1; layerIdx < neuronsInLayers.size(); layerIdx++){
                        Integer neuronsNum = neuronsInLayers.get(layerIdx);
      // createLayer layer
View Full Code Here

        matrixLayers[0] = new MatrixInputLayer(sourceNetwork.getLayers().get(0).getNeuronsCount());

        MatrixLayer prevLayer = matrixLayers[0];
       
         for(int i =1; i < sourceNetwork.getLayersCount(); i++  ) {
            Layer layer = sourceNetwork.getLayerAt(i);
            MatrixMlpLayer newBpLayer = new MatrixMlpLayer(layer, prevLayer, new Tanh());
            matrixLayers[i] = newBpLayer;
            prevLayer = newBpLayer;
        }
    }
View Full Code Here

                // create input layer neuron settings for this network
    NeuronProperties inNeuronProperties = new NeuronProperties();
    inNeuronProperties.setProperty("transferFunction", TransferFunctionType.LINEAR);

    // createLayer input layer with specified number of neurons
    Layer inputLayer = LayerFactory.createLayer(inputNeuronsCount, inNeuronProperties);
                inputLayer.addNeuron(new BiasNeuron()); // add bias neuron (always 1, and it will act as bias input for output neuron)
    this.addLayer(inputLayer);
               
               // create output layer neuron settings for this network
    NeuronProperties outNeuronProperties = new NeuronProperties();
    outNeuronProperties.setProperty("transferFunction", TransferFunctionType.RAMP);
    outNeuronProperties.setProperty("transferFunction.slope", new Double(1));
    outNeuronProperties.setProperty("transferFunction.yHigh", new Double(1));
    outNeuronProperties.setProperty("transferFunction.xHigh", new Double(1));
    outNeuronProperties.setProperty("transferFunction.yLow", new Double(-1));
    outNeuronProperties.setProperty("transferFunction.xLow", new Double(-1));

    // createLayer output layer (only one neuron)
    Layer outputLayer = LayerFactory.createLayer(1, outNeuronProperties);
    this.addLayer(outputLayer);

    // createLayer full conectivity between input and output layer
    ConnectionFactory.fullConnect(inputLayer, outputLayer);
View Full Code Here

                // set network type
    this.setNetworkType(NeuralNetworkType.BAM);

    // create input layer
    Layer inputLayer = LayerFactory.createLayer(inputNeuronsCount, neuronProperties);
    // add input layer to network
    this.addLayer(inputLayer);

    // create output layer
    Layer outputLayer = LayerFactory.createLayer(outputNeuronsCount, neuronProperties)
    // add output layer to network
    this.addLayer(outputLayer);
   
    // create full connectivity from in to out layer 
    ConnectionFactory.fullConnect(inputLayer, outputLayer);   
View Full Code Here

   
    // set network type code
    this.setNetworkType(NeuralNetworkType.SUPERVISED_HEBBIAN_NET);

    // createLayer input layer
    Layer inputLayer = LayerFactory.createLayer(inputNeuronsNum,
      neuronProperties);
    this.addLayer(inputLayer);

    // createLayer output layer
    Layer outputLayer = LayerFactory.createLayer(outputNeuronsNum,
      neuronProperties);
    this.addLayer(outputLayer);

    // createLayer full conectivity between input and output layer
    ConnectionFactory.fullConnect(inputLayer, outputLayer);
View Full Code Here

  private void createNetwork(int inputNeuronsCount, int outputNeuronsCount) {
    // set network type
    this.setNetworkType(NeuralNetworkType.COMPETITIVE);

    // createLayer input layer
    Layer inputLayer = LayerFactory.createLayer(inputNeuronsCount, new NeuronProperties());
    this.addLayer(inputLayer);

    // createLayer properties for neurons in output layer
    NeuronProperties neuronProperties = new NeuronProperties();
    neuronProperties.setProperty("neuronType", CompetitiveNeuron.class);
View Full Code Here

    // set network type
    this.setNetworkType(NeuralNetworkType.MAXNET);

    // createLayer input layer in layer
    Layer inputLayer = LayerFactory.createLayer(neuronsCount,
        new NeuronProperties());
    this.addLayer(inputLayer);

    // createLayer properties for neurons in output layer
    NeuronProperties neuronProperties = new NeuronProperties();
View Full Code Here

    double[] weights = flatNetwork.getWeights();

    int index = 0;

    for (int layerIndex = network.getLayers().size() - 1; layerIndex > 0; layerIndex--) {
      Layer layer = network.getLayers().get(layerIndex);

      for (Neuron neuron : layer.getNeurons()) {
        for (Connection connection : neuron.getInputConnections()) {
          if (index >= weights.length)
            throw new EncogEngineError("Weight size mismatch.");

          Weight weight = connection.getWeight();
View Full Code Here

   * @return True if unflattening was successful.
   */
  public static boolean unFlattenNeuralNetworkNetwork(NeuralNetwork network) {

    for (int layerIndex = network.getLayers().size() - 1; layerIndex > 0; layerIndex--) {
      Layer layer = network.getLayers().get(layerIndex);

      for (Neuron neuron : layer.getNeurons()) {
        for (Connection connection : neuron.getInputConnections()) {
          Weight weight = connection.getWeight();

          if (weight instanceof FlatWeight) {
            Weight weight2 = new Weight(weight.getValue());
View Full Code Here

TOP

Related Classes of org.neuroph.core.Layer

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.