public interface Model
Modifier and Type | Method and Description |
---|---|
void |
accumulateScore(double accum)
Sets a rolling tally for the score.
|
void |
applyLearningRateScoreDecay()
Update learningRate using for this model.
|
int |
batchSize()
The current inputs batch size
|
void |
clear()
Clear input
|
void |
computeGradientAndScore()
Update the score
|
NeuralNetConfiguration |
conf()
The configuration for the neural network
|
void |
fit()
All models have a fit method
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray data)
Fit the model to the given data
|
ConvexOptimizer |
getOptimizer()
Returns this models optimizer
|
org.nd4j.linalg.api.ndarray.INDArray |
getParam(java.lang.String param)
Get the parameter
|
Gradient |
gradient()
Calculate a gradient
|
Pair<Gradient,java.lang.Double> |
gradientAndScore()
Get the gradient and score
|
void |
init()
Init the model
|
void |
initParams()
Deprecated.
As of 0.7.3 - Feb 2017. Not used; neural network params are initialized by the parameter initializaters.
Furthermore, most implementations are unsupported or no-op.
|
org.nd4j.linalg.api.ndarray.INDArray |
input()
The input/feature matrix for the model
|
void |
iterate(org.nd4j.linalg.api.ndarray.INDArray input)
Run one iteration
|
int |
numParams()
the number of parameters for the model
|
int |
numParams(boolean backwards)
the number of parameters for the model
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Parameters of the model (if any)
|
java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> |
paramTable()
The param table
|
java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> |
paramTable(boolean backpropParamsOnly)
Table of parameters by key, for backprop
For many models (dense layers, etc) - all parameters are backprop parameters
|
double |
score()
The score for the model
|
void |
setBackpropGradientsViewArray(org.nd4j.linalg.api.ndarray.INDArray gradients)
Set the gradients array as a view of the full (backprop) network parameters
NOTE: this is intended to be used internally in MultiLayerNetwork and ComputationGraph, not by users.
|
void |
setConf(NeuralNetConfiguration conf)
Setter for the configuration
|
void |
setListeners(java.util.Collection<IterationListener> listeners)
Set the IterationListeners for the ComputationGraph (and all layers in the network)
|
void |
setListeners(IterationListener... listeners)
Set the IterationListeners for the ComputationGraph (and all layers in the network)
|
void |
setParam(java.lang.String key,
org.nd4j.linalg.api.ndarray.INDArray val)
Set the parameter with a new ndarray
|
void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Set the parameters for this model.
|
void |
setParamsViewArray(org.nd4j.linalg.api.ndarray.INDArray params)
Set the initial parameters array as a view of the full (backprop) network parameters
NOTE: this is intended to be used internally in MultiLayerNetwork and ComputationGraph, not by users.
|
void |
setParamTable(java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> paramTable)
Setter for the param table
|
void |
update(Gradient gradient)
Update layer weights and biases with gradient change
|
void |
update(org.nd4j.linalg.api.ndarray.INDArray gradient,
java.lang.String paramType)
Perform one update applying the gradient
|
void |
validateInput()
Deprecated.
As of 0.7.3 - Feb 2017. No longer used, most implementations are unsupported or no-op.
|
void init()
void setListeners(java.util.Collection<IterationListener> listeners)
void setListeners(IterationListener... listeners)
void fit()
void update(Gradient gradient)
void update(org.nd4j.linalg.api.ndarray.INDArray gradient, java.lang.String paramType)
gradient
- the gradient to applydouble score()
void computeGradientAndScore()
void accumulateScore(double accum)
accum
- the amount to accumorg.nd4j.linalg.api.ndarray.INDArray params()
int numParams()
int numParams(boolean backwards)
void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
params
- the parameters for the modelvoid setParamsViewArray(org.nd4j.linalg.api.ndarray.INDArray params)
params
- a 1 x nParams row vector that is a view of the larger (MLN/CG) parameters arrayvoid setBackpropGradientsViewArray(org.nd4j.linalg.api.ndarray.INDArray gradients)
gradients
- a 1 x nParams row vector that is a view of the larger (MLN/CG) gradients arrayvoid applyLearningRateScoreDecay()
void fit(org.nd4j.linalg.api.ndarray.INDArray data)
data
- the data to fit the model tovoid iterate(org.nd4j.linalg.api.ndarray.INDArray input)
input
- the input to iterate onGradient gradient()
Pair<Gradient,java.lang.Double> gradientAndScore()
int batchSize()
NeuralNetConfiguration conf()
void setConf(NeuralNetConfiguration conf)
conf
- org.nd4j.linalg.api.ndarray.INDArray input()
@Deprecated void validateInput()
ConvexOptimizer getOptimizer()
org.nd4j.linalg.api.ndarray.INDArray getParam(java.lang.String param)
param
- the key of the parameter@Deprecated void initParams()
java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> paramTable()
java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> paramTable(boolean backpropParamsOnly)
backpropParamsOnly
- If true, return backprop params only. If false: return all params (equivalent to
paramsTable())void setParamTable(java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> paramTable)
paramTable
- void setParam(java.lang.String key, org.nd4j.linalg.api.ndarray.INDArray val)
key
- the key to se tval
- the new ndarrayvoid clear()