Package dk.alexandra.fresco.stat
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 DRes<MLP>fit(MLP network, List<ArrayList<DRes<SFixed>>> data, List<ArrayList<DRes<SFixed>>> labels, int epochs, double learningRate)Fit the given multilayer perceptron to a dataset using back propagation.DRes<ArrayList<DRes<SFixed>>>logisticRegression(Matrix<DRes<SFixed>> data, ArrayList<DRes<SFixed>> expected, double[] beta, IntToDoubleFunction rate, int epochs)Estimate the parameters of a logistic model using gradient descent.DRes<SInt>predict(MLP network, ArrayList<DRes<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 MachineLearningusing(ProtocolBuilderNumeric builder)
-
Method Details
-
using
-
logisticRegression
DRes<ArrayList<DRes<SFixed>>> logisticRegression(Matrix<DRes<SFixed>> data, ArrayList<DRes<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
DRes<MLP> fit(MLP network, List<ArrayList<DRes<SFixed>>> data, List<ArrayList<DRes<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
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.
-