Interface MachineLearning

All Known Implementing Classes:
DefaultMachineLearning

public interface MachineLearning
This computation library contains various functions for machine learning.
  • Method Summary

    Modifier and Type Method Description
    dk.alexandra.fresco.framework.DRes<MLP> fit​(MLP network, 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)
    Fit the given multilayer perceptron to a dataset using back propagation.
    dk.alexandra.fresco.framework.DRes<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>> logisticRegression​(dk.alexandra.fresco.lib.common.collections.Matrix<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> data, ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> expected, double[] beta, IntToDoubleFunction rate, int epochs)
    Estimate the parameters of a logistic model using gradient descent.
    dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> predict​(MLP network, ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> input)
    Assuming that the given MLP has n output neurons, this function applies the network to the given input and finds the index of the output i with 0 ≤ i < n containing the largest number.
    static MachineLearning using​(dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric builder)  
  • Method Details

    • using

      static MachineLearning using​(dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric builder)
    • logisticRegression

      dk.alexandra.fresco.framework.DRes<ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>>> logisticRegression​(dk.alexandra.fresco.lib.common.collections.Matrix<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> data, ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> expected, double[] beta, IntToDoubleFunction rate, int epochs)
      Estimate the parameters of a logistic model using gradient descent.
      Parameters:
      data - The data represented as a matrix with entry as rows.
      expected - The expected outcome for each entry represented as a list. Each entry should be either 0 or 1.
      beta - The initial guess for the parameters of the model with the first being the constant term.
      rate - The learning rate used by the gradient descent algorithm as a function of the iteration number.
      epochs - The number of iterations.
      Returns:
      An approximation of the parameters of a logistic model fitting the given data.
    • fit

      dk.alexandra.fresco.framework.DRes<MLP> fit​(MLP network, 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)
      Fit the given multilayer perceptron to a dataset using back propagation.
      Parameters:
      network - The mlp to fit.
      data - The dataset to use as input.
      labels - The expected outputs.
      epochs - The number of epochs, ie. iterations through the entire dataset.
      learningRate - The learning rate.
      Returns:
      A new MLP with updated weights.
    • predict

      dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> predict​(MLP network, ArrayList<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> input)
      Assuming that the given MLP has n output neurons, this function applies the network to the given input and finds the index of the output i with 0 ≤ i < n containing the largest number.
      Parameters:
      network - The multi-layer perceptron to use for the prediction.
      input - The input.
      Returns:
      The index of the largest element in the output vector.