Package org.joone.net

Examples of org.joone.net.NeuralNet


  public <T extends PerformanceTuple> IPerformancePredictor generatePredictor(
      List<T> trainingData, PerfTupleMetaData metaData) {

    int numOfAttributes = metaData.getNumOfAttributes();

    NeuralNet nn = createNeuralNetwork(numOfAttributes);

    configureLearning(trainingData, nn.getMonitor());

    // Create input synapse
    PerformanceTupleInputSynapse inpSynapse =
        new PerformanceTupleInputSynapse(trainingData, metaData);
    nn.getInputLayer().addInputSynapse(inpSynapse);
    if (numOfAttributes < 1) {
      throw new IllegalArgumentException(
          "the number of attributes must be > 0.");
    }
    inpSynapse.setAdvancedColumnSelector(numOfAttributes == 1 ? "1" : "1-"
View Full Code Here


   *          number of input values (determines size of input layer)
   * @return neural network
   */
  protected NeuralNet createNeuralNetwork(int numAttribs) {

    NeuralNet nn = new NeuralNet();
    List<Layer> nnLayers = new ArrayList<>();
    LinearLayer inputLayer = new LinearLayer();
    inputLayer.setRows(numAttribs);
    nnLayers.add(inputLayer);

    // Create network structure iteratively
    Layer lastLayer = inputLayer;
    for (int i = 0; i < hiddenLayers; i++) {

      Layer currentLayer = NNLayer.newInstance(layer);
      currentLayer.setRows(hiddenLayerRows);

      Synapse currentSynapse = NNSynapse.newInstance(synapse);

      lastLayer.addOutputSynapse(currentSynapse);
      currentLayer.addInputSynapse(currentSynapse);

      nnLayers.add(currentLayer);
      lastLayer = currentLayer;
    }
    Synapse synapseToOutLayer = NNSynapse.newInstance(synapse);
    lastLayer.addOutputSynapse(synapseToOutLayer);

    LinearLayer outputLayer = new LinearLayer();
    outputLayer.addInputSynapse(synapseToOutLayer);
    outputLayer.setRows(1);

    //Add Layers to neural network (doing it afterwards prevents Joone warnings)
    nn.addLayer(nnLayers.remove(0), NeuralNet.INPUT_LAYER);
    for (Layer hiddenLayer : nnLayers) {
      nn.addLayer(hiddenLayer, NeuralNet.HIDDEN_LAYER);
    }
    nn.addLayer(outputLayer, NeuralNet.OUTPUT_LAYER);
    return nn;
  }
View Full Code Here

TOP

Related Classes of org.joone.net.NeuralNet

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.