Package org.neuroph.core

Examples of org.neuroph.core.Neuron


  }
 
  private void createTypeConnections() {
    // input connections for the first product type
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(i);
      Neuron toNeuron = this.getLayerAt(typeLayerIdx).getNeuronAt(0);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // input connections for the second product type
    for(int i = 7; i < 14; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(i);
      Neuron toNeuron = this.getLayerAt(typeLayerIdx).getNeuronAt(1);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // input connections for the third product type
    for(int i = 14; i < 20; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(i);
      Neuron toNeuron = this.getLayerAt(typeLayerIdx).getNeuronAt(2);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }   
   
   
    // output connections for the first product type
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(typeLayerIdx).getNeuronAt(0);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(i);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the second product type
    for(int i = 7; i < 14; i++) {
      Neuron fromNeuron = this.getLayerAt(typeLayerIdx).getNeuronAt(1);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(i);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the third product type
    for(int i = 14; i < 20; i++) {
      Neuron fromNeuron = this.getLayerAt(typeLayerIdx).getNeuronAt(2);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(i);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }     
  }
View Full Code Here


    int lg[] = {2, 3, 10, 11, 16, 17};
    int sony[] = {4, 5, 6, 12, 13, 18, 19};
   
    // create samsung input sonnections
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(samsung[i]);
      Neuron toNeuron = this.getLayerAt(brandLayerIdx).getNeuronAt(0);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // create input connections for LG
    for(int i = 0; i < 6; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(lg[i]);
      Neuron toNeuron = this.getLayerAt(brandLayerIdx).getNeuronAt(1);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // create input connections for sony
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(sony[i]);
      Neuron toNeuron = this.getLayerAt(brandLayerIdx).getNeuronAt(2);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }   
   
   
    // output connections for the first brand
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(brandLayerIdx).getNeuronAt(0);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(samsung[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the second brand
    for(int i = 0; i < 6; i++) {
      Neuron fromNeuron = this.getLayerAt(brandLayerIdx).getNeuronAt(1);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(lg[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the third brand
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(brandLayerIdx).getNeuronAt(2);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(sony[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }     
  } 
View Full Code Here

    int mid[] = {3, 5, 8, 11, 12, 14, 19};
    int high[] = {1, 6, 9, 13, 15, 17};   
   
    // input connections for the first price class
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(low[i]);
      Neuron toNeuron = this.getLayerAt(priceLayerIdx).getNeuronAt(0);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // input connections for the second price class
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(mid[i]);
      Neuron toNeuron = this.getLayerAt(priceLayerIdx).getNeuronAt(1);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // input connections for the third price class
    for(int i = 0; i < 6; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(high[i]);
      Neuron toNeuron = this.getLayerAt(priceLayerIdx).getNeuronAt(2);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }   
   
   
    // output connections for the first price class
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(priceLayerIdx).getNeuronAt(0);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(low[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the second price class
    for(int i = 0; i < 7; i++) {
      Neuron fromNeuron = this.getLayerAt(priceLayerIdx).getNeuronAt(1);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(mid[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the third price class
    for(int i = 0; i < 6; i++) {
      Neuron fromNeuron = this.getLayerAt(priceLayerIdx).getNeuronAt(2);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(high[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }     
  }   
View Full Code Here

    int new_products[] = {6, 9};
    int bestsellers[] = {3, 12, 14};   
   
    // input connections for the first promo type
    for(int i = 0; i < sales.length; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(sales[i]);
      Neuron toNeuron = this.getLayerAt(promoLayerIdx).getNeuronAt(0);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // input connections for the second promo type
    for(int i = 0; i < new_products.length; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(new_products[i]);
      Neuron toNeuron = this.getLayerAt(promoLayerIdx).getNeuronAt(1);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // input connections for the third promo type
    for(int i = 0; i < bestsellers.length; i++) {
      Neuron fromNeuron = this.getLayerAt(inputLayerIdx).getNeuronAt(bestsellers[i]);
      Neuron toNeuron = this.getLayerAt(promoLayerIdx).getNeuronAt(2);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }   

    // output connections for the first promo type
    for(int i = 0; i < sales.length; i++) {
      Neuron fromNeuron = this.getLayerAt(promoLayerIdx).getNeuronAt(0);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(sales[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the second promo type
    for(int i = 0; i < new_products.length; i++) {
      Neuron fromNeuron = this.getLayerAt(promoLayerIdx).getNeuronAt(1);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(new_products[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }
   
    // output connections for the third promo type
    for(int i = 0; i < bestsellers.length; i++) {
      Neuron fromNeuron = this.getLayerAt(promoLayerIdx).getNeuronAt(2);
      Neuron toNeuron = this.getLayerAt(outputLayerIdx).getNeuronAt(bestsellers[i]);
      this.createConnection(fromNeuron, toNeuron, 0.1);
    }     
  } 
View Full Code Here



    TransferFunction transferFunction = createTransferFunction(neuronProperties.getTransferFunctionProperties());

    Neuron neuron = null;
    Class neuronClass = neuronProperties.getNeuronType();

                // use two param constructor to create neuron
                    try {
                        Class[] paramTypes = {InputFunction.class, TransferFunction.class};
View Full Code Here

  public static Layer createLayer(Vector<NeuronProperties> neuronPropertiesVector) {
    Layer layer = new Layer();
   
    for(NeuronProperties neuronProperties : neuronPropertiesVector) {
      Neuron neuron = NeuronFactory.createNeuron(neuronProperties);
      layer.addNeuron(neuron);
    }
   
    return layer;
  }
View Full Code Here

   *
   * @return one or more image labels with the maximum output
   */
  public HashMap<String, Neuron> getMaxOutput() {
    HashMap<String, Neuron> maxOutput = new HashMap<String, Neuron>();
    Neuron maxNeuron = this.getParentNetwork().getOutputNeurons().get(0);

    for (Neuron neuron : this.getParentNetwork().getOutputNeurons()) {
      if (neuron.getOutput() > maxNeuron.getOutput())
        maxNeuron = neuron;
    }

    LabelsPlugin labels = (LabelsPlugin) this.getParentNetwork().getPlugin(
        LabelsPlugin.class);

    maxOutput.put(labels.getLabel(maxNeuron), maxNeuron);

    for (Neuron neuron : this.getParentNetwork().getOutputNeurons()) {
      if (neuron.getOutput() == maxNeuron.getOutput()) {
        maxOutput.put(labels.getLabel(neuron), neuron);
      }
    }

    return maxOutput;
View Full Code Here

  private static void assignLabelsToOutputNeurons(NeuralNetwork neuralNetwork, List<String> imageLabels) {
    List<Neuron> outputNeurons = neuralNetwork.getOutputNeurons();
    LabelsPlugin labelsPlugin = (LabelsPlugin) neuralNetwork.getPlugin(LabelsPlugin.class);
   
    for(int i=0; i<outputNeurons.size(); i++) {
      Neuron neuron = outputNeurons.get(i);
      String label = imageLabels.get(i);
      neuron.setLabel(label);
    }
  }
View Full Code Here

    int neuronNum = layer.getNeuronsCount();
    for (int i = 0; i < neuronNum; i++) {
      for (int j = 0; j < neuronNum; j++) {
        if (j == i)
          continue;
        Neuron from = layer.getNeuronAt(i);
        Neuron to = layer.getNeuronAt(j);
        createConnection(from, to);
      } // j
    } // i
  }
View Full Code Here

    int neuronNum = layer.getNeuronsCount();
    for (int i = 0; i < neuronNum; i++) {
      for (int j = 0; j < neuronNum; j++) {
        if (j == i)
          continue;
        Neuron from = layer.getNeuronAt(i);
        Neuron to = layer.getNeuronAt(j);
        createConnection(from, to, weightVal);
      } // j
    } // i
  }
View Full Code Here

TOP

Related Classes of org.neuroph.core.Neuron

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.