Class MLP

java.lang.Object
dk.alexandra.fresco.stat.mlp.MLP

public class MLP
extends Object
This class represents layered neural networks. Computing a networks output on a sample is done using the apply(ArrayList) method. Prediction is done using Predict. Training a network is done using the fit(List, List, int, double) method. Instances of this class are immutable.
  • Constructor Summary

    Constructors 
    Constructor Description
    MLP​(List<Layer> layers)  
  • Method Summary

    Modifier and Type Method Description
    dk.alexandra.fresco.framework.builder.Computation<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric> apply​(ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> input)
    Apply this neural network in an input vector.
    dk.alexandra.fresco.framework.builder.Computation<MLP,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric> fit​(List<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>> data, List<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>> labels, int epochs, double learningRate)
    Train this neural network using single step training (batch size = 1) and return a new neural network with the updated weights.
    Layer getLayer​(int i)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getLayer

      public Layer getLayer​(int i)
    • fit

      public dk.alexandra.fresco.framework.builder.Computation<MLP,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric> fit​(List<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>> data, List<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>> labels, int epochs, double learningRate)
      Train this neural network using single step training (batch size = 1) and return a new neural network with the updated weights.
      Parameters:
      data - The training data.
      labels - The expected outputs.
      epochs - The number of epochs to run the training. One epoch is an iteration over all training data.
      learningRate - The learning rate.
      Returns:
      A new neural network with weights updated from this network.
    • apply

      public dk.alexandra.fresco.framework.builder.Computation<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric> apply​(ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> input)
      Apply this neural network in an input vector.