Examples of Neuron


Examples of org.neuroph.core.Neuron

  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

Examples of org.neuroph.core.Neuron

    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

Examples of org.neuroph.core.Neuron

    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

Examples of org.neuroph.core.Neuron

    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, delay);
      } // j
    } // i
  }
View Full Code Here

Examples of org.neuroph.core.Neuron

   * @param toLayer
   *            layer to connect to
   */
  public static void forwardConnect(Layer fromLayer, Layer toLayer, double weightVal) {
    for(int i=0; i<fromLayer.getNeuronsCount(); i++) {
      Neuron fromNeuron = fromLayer.getNeuronAt(i);
      Neuron toNeuron = toLayer.getNeuronAt(i);
      createConnection(fromNeuron, toNeuron, weightVal);
    }
  }
View Full Code Here

Examples of org.neuroph.core.Neuron

   * @param toLayer
   *            layer to connect to
   */
  public static void forwardConnect(Layer fromLayer, Layer toLayer) {
    for(int i=0; i<fromLayer.getNeuronsCount(); i++) {
      Neuron fromNeuron = fromLayer.getNeuronAt(i);
      Neuron toNeuron = toLayer.getNeuronAt(i);
      createConnection(fromNeuron, toNeuron, 1);
    }   
  }
View Full Code Here

Examples of org.neuroph.core.Neuron

    // parametre
    Iterator<Neuron> ii = setLayer.getNeuronsIterator();
    Enumeration<Integer> en;// =setLayer.neurons();
    int c = 0;
    while (ii.hasNext()) {
      Neuron cell = ii.next();
      Trapezoid tf = (Trapezoid) cell.getTransferFunction();

      if (c <= 3) {
        tf.setLeftLow(pointsSets[c][0]);
        tf.setLeftHigh(pointsSets[c][1]);
        tf.setRightLow(pointsSets[c][3]);
        tf.setRightHigh(pointsSets[c][2]);
      } else {
        tf.setLeftLow(timeSets[c - 4][0]);
        tf.setLeftHigh(timeSets[c - 4][1]);
        tf.setRightLow(timeSets[c - 4][3]);
        tf.setRightHigh(timeSets[c - 4][2]);
      }
      c++;
    }

    // povezi prvi i drugi sloj
    int s = 0; // brojac celija sloja skupova (fazifikacije)
    for (int i = 0; i < inputNum; i++) { // brojac ulaznih celija
      Neuron from = inLayer.getNeuronAt(i);
      int jmax = inputSets.elementAt(i).intValue();
      for (int j = 0; j < jmax; j++) {
        Neuron to = setLayer.getNeuronAt(s);
        ConnectionFactory.createConnection(from, to, 1);
        s++;
      }
    }

    // ----------------------------------------------------------

    // createLayer rules layer
    NeuronProperties ruleNeuronProperties = new NeuronProperties(
                        WeightsFunctionType.WEIGHTED_INPUT,
                        SummingFunctionType.MIN,
                        TransferFunctionType.LINEAR);
    en = inputSets.elements();
    int fuzzyAntNum = 1;
    while (en.hasMoreElements()) {
      Integer i = en.nextElement();
      fuzzyAntNum = fuzzyAntNum * i.intValue();
    }
    Layer ruleLayer = LayerFactory.createLayer(fuzzyAntNum,
        ruleNeuronProperties);
    this.addLayer(ruleLayer);

    int scIdx = 0; // set cell index

    for (int i = 0; i < inputNum; i++) { // brojac ulaza (grupa fuzzy
                        // skupova)
      int setsNum = inputSets.elementAt(i).intValue();

      for (int si = 0; si < setsNum; si++) { // brojac celija fuzzy
                          // skupova
        if (i == 0) {
          Neuron from = setLayer.getNeuronAt(si);
          int connPerCell = fuzzyAntNum / setsNum;
          scIdx = si;

          for (int k = 0; k < connPerCell; k++) { // brojac celija
                              // hipoteza
            Neuron to = ruleLayer.getNeuronAt(si * connPerCell + k);
            ConnectionFactory.createConnection(from, to,
                new Double(1));
          } // for
        } // if
        else {
          scIdx++;
          Neuron from = setLayer.getNeuronAt(scIdx);
          int connPerCell = fuzzyAntNum / setsNum;

          for (int k = 0; k < connPerCell; k++) { // brojac celija
                              // hipoteza
            int toIdx = si + k * setsNum;
            Neuron to = ruleLayer.getNeuronAt(toIdx);
            ConnectionFactory.createConnection(from, to,
                new Double(1));
          } // for k
        } // else
      } // for si
View Full Code Here

Examples of org.neuroph.core.Neuron

    // parametre
    Iterator<Neuron> ii = setLayer.getNeuronsIterator();
    Enumeration<Integer> en;// =setLayer.neurons();
    int c = 0;
    while (ii.hasNext()) {
      Neuron cell = ii.next();
      Trapezoid tf = (Trapezoid) cell.getTransferFunction();
      /*
       * if (c<=3) { tf.setLeftLow(pointsSets[c][0]);
       * tf.setLeftHigh(pointsSets[c][1]); tf.setRightLow(pointsSets[c][3]);
       * tf.setRightHigh(pointsSets[c][2]); } else { tf.setLeftLow(timeSets[c-4][0]);
       * tf.setLeftHigh(timeSets[c-4][1]); tf.setRightLow(timeSets[c-4][3]);
       * tf.setRightHigh(timeSets[c-4][2]); } c++;
       */
    }

    // createLayer connections between input and fuzzy set getLayersIterator
    int s = 0; // brojac celija sloja skupova (fazifikacije)
    for (int i = 0; i < inputNum; i++) { // brojac ulaznih celija
      Neuron from = inLayer.getNeuronAt(i);
      int jmax = inputSets.elementAt(i).intValue();
      for (int j = 0; j < jmax; j++) {
        Neuron to = setLayer.getNeuronAt(s);
        ConnectionFactory.createConnection(from, to, new Double(1));
        s++;
      }
    }

    // ----------------------------------------------------------

    // kreiraj sloj pravila
    neuronProperties
        .setProperty("summingFunction", SummingFunctionType.MIN);
    neuronProperties.setProperty("transferFunction",
        TransferFunctionType.LINEAR);
    en = inputSets.elements();
    int fuzzyAntNum = 1;
    while (en.hasMoreElements()) {
      Integer i = en.nextElement();
      fuzzyAntNum = fuzzyAntNum * i.intValue();
    }
    Layer ruleLayer = LayerFactory.createLayer(new Integer(fuzzyAntNum),
        neuronProperties);
    this.addLayer(ruleLayer);

    // povezi set i rule layer

    int scIdx = 0; // set cell index

    for (int i = 0; i < inputNum; i++) { // brojac ulaza (grupa fuzzy
                        // skupova)
      int setsNum = inputSets.elementAt(i).intValue();

      for (int si = 0; si < setsNum; si++) { // brojac celija fuzzy
                          // skupova
        if (i == 0) {
          Neuron from = setLayer.getNeuronAt(si);
          int connPerCell = fuzzyAntNum / setsNum;
          scIdx = si;

          for (int k = 0; k < connPerCell; k++) { // brojac celija
                              // hipoteza
            Neuron to = ruleLayer.getNeuronAt(si * connPerCell + k);
            ConnectionFactory.createConnection(from, to,
                new Double(1));
          } // for
        } // if
        else {
          scIdx++;
          Neuron from = setLayer.getNeuronAt(scIdx);
          int connPerCell = fuzzyAntNum / setsNum;

          for (int k = 0; k < connPerCell; k++) { // brojac celija
                              // hipoteza
            int toIdx = si + k * setsNum;
            Neuron to = ruleLayer.getNeuronAt(toIdx);
            ConnectionFactory.createConnection(from, to,
                new Double(1));
          } // for k
        } // else
      } // for si
View Full Code Here

Examples of org.neuroph.core.Neuron

    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (j == i)
          continue;
        Neuron ni = hopfieldLayer.getNeuronAt(i);
        Neuron nj = hopfieldLayer.getNeuronAt(j);
        Connection cij = nj.getConnectionFrom(ni);
        Connection cji = ni.getConnectionFrom(nj);
        double w = 0;
        for (int k = 0; k < M; k++) {
          TrainingElement trainingElement = trainingSet.elementAt(k);
          double pki = trainingElement.getInput()[i];
View Full Code Here

Examples of org.neuroph.core.Neuron

  }

  private void learnPattern(TrainingElement tE, int neighborhood) {
    neuralNetwork.setInput(tE.getInput());
    neuralNetwork.calculate();
    Neuron winner = getClosest();
    if (winner.getOutput() == 0)
      return; // ako je vec istrenirana jedna celija, izadji

    Layer mapLayer = neuralNetwork.getLayerAt(1);
    int winnerIdx = mapLayer.indexOf(winner);
    adjustCellWeights(winner, 0);

    int cellNum = mapLayer.getNeuronsCount();
    for (int p = 0; p < cellNum; p++) {
      if (p == winnerIdx)
        continue;
      if (isNeighbor(winnerIdx, p, neighborhood)) {
        Neuron cell = mapLayer.getNeuronAt(p);
        adjustCellWeights(cell, 1);
      } // if
    } // for

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.