public final class MultilayerPerceptron extends Object implements SmoothParametrized<MultilayerPerceptron>
| Constructor and Description |
|---|
MultilayerPerceptron(MLPArchitecture arch)
Construct MLP from given architecture.
|
MultilayerPerceptron(MLPArchitecture arch,
MLPInitializer initializer)
Construct MLP from given architecture and parameters initializer.
|
| Modifier and Type | Method and Description |
|---|---|
MultilayerPerceptron |
add(MultilayerPerceptron above)
Create MLP where this MLP output is fed as input to added MLP.
|
MLPArchitecture |
architecture()
Get architecture of this MLP.
|
double |
bias(int layerIdx,
int neuronIdx)
Get the bias of given neuron in given layer.
|
Vector |
biases(int layerIdx)
Get biases of layer with given index.
|
MLPState |
computeState(Matrix val)
Perform forward pass and return state of outputs of each layer.
|
Vector |
differentiateByParameters(IgniteFunction<Vector,IgniteDifferentiableVectorToDoubleFunction> loss,
Matrix inputsBatch,
Matrix truthBatch)
Compose function in the following way: feed output of this model as input to second argument to loss function.
|
Matrix |
forwardPass(Matrix val,
MLPState state,
boolean writeState)
Perform forward pass and if needed write state of outputs of each layer.
|
boolean |
hasBiases(int layerIdx)
Checks if layer with given index has biases.
|
int |
layersCount()
Get count of layers in this MLP.
|
Vector |
parameters()
Get parameters vector.
|
int |
parametersCount()
Get count of parameters of this model.
|
Matrix |
predict(Matrix val)
Makes a prediction for the given objects.
|
MultilayerPerceptron |
setBias(int layerIdx,
int neuronIdx,
double val)
Set the bias of given neuron in given layer.
|
MultilayerPerceptron |
setBiases(int layerIdx,
Vector bias)
Sets the biases of layer with a given index.
|
MultilayerPerceptron |
setParameters(Vector vector)
Set parameters.
|
MultilayerPerceptron |
setWeight(int layerIdx,
int fromNeuron,
int toNeuron,
double val)
Set the weight of neuron with given index in previous layer to neuron with given index in given layer.
|
MultilayerPerceptron |
setWeights(int layerIdx,
Matrix weights)
Sets the weighs of layer with a given index.
|
String |
toString() |
String |
toString(boolean pretty) |
double |
weight(int layerIdx,
int fromNeuron,
int toNeuron)
Get the weight of neuron with given index in previous layer to neuron with given index in given layer.
|
Matrix |
weights(int layerIdx)
Get weights of layer with given index.
|
default M |
withParameters(Vector vector)
Return new model with given parameters vector.
|
public MultilayerPerceptron(MLPArchitecture arch, MLPInitializer initializer)
arch - Architecture.initializer - Parameters initializer.public MultilayerPerceptron(MLPArchitecture arch)
arch - Architecture.public MLPState computeState(Matrix val)
val - Value to perform computation on.public Matrix forwardPass(Matrix val, MLPState state, boolean writeState)
val - Value to perform computation on.state - State object to write state into.writeState - Flag indicating need to write state.public MultilayerPerceptron add(MultilayerPerceptron above)
above - Added MLP.public Matrix weights(int layerIdx)
layerIdx - Layer index.public Vector biases(int layerIdx)
layerIdx - Layer index.public boolean hasBiases(int layerIdx)
layerIdx - Layer index.public MultilayerPerceptron setBiases(int layerIdx, Vector bias)
layerIdx - Layer index.bias - New values for biases.public MultilayerPerceptron setBias(int layerIdx, int neuronIdx, double val)
layerIdx - Layer index.neuronIdx - Neuron index.val - New value of bias.public double bias(int layerIdx,
int neuronIdx)
layerIdx - Layer index.neuronIdx - Neuron index.public MultilayerPerceptron setWeights(int layerIdx, Matrix weights)
layerIdx - Layer index.weights - New values for weights.public MultilayerPerceptron setWeight(int layerIdx, int fromNeuron, int toNeuron, double val)
layerIdx - Layer index.fromNeuron - Neuron index in previous layer.toNeuron - Neuron index in current layer.val - New value of weight.public double weight(int layerIdx,
int fromNeuron,
int toNeuron)
layerIdx - Layer index.fromNeuron - Neuron index in previous layer.toNeuron - Neuron index in current layer.public int layersCount()
public MLPArchitecture architecture()
public Vector differentiateByParameters(IgniteFunction<Vector,IgniteDifferentiableVectorToDoubleFunction> loss, Matrix inputsBatch, Matrix truthBatch)
differentiateByParameters in interface SmoothParametrized<MultilayerPerceptron>loss - Loss function.inputsBatch - Batch of inputs.truthBatch - Batch of ground truths.public Vector parameters()
public MultilayerPerceptron setParameters(Vector vector)
vector - Parameters vector.public int parametersCount()
public String toString(boolean pretty)
toString in interface IgniteModel<Matrix,Matrix>pretty - Use pretty mode.public M withParameters(Vector vector)
vector - Parameters vector.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.14.0 Release Date : September 29 2022