Package org.deeplearning4j.nn.api
Interface Model
-
- All Known Subinterfaces:
Classifier
,IOutputLayer
,Layer
,RecurrentLayer
- All Known Implementing Classes:
AbstractLayer
,ActivationLayer
,AutoEncoder
,BaseLayer
,BaseOutputLayer
,BasePretrainNetwork
,BaseRecurrentLayer
,BaseWrapperLayer
,BatchNormalization
,BidirectionalLayer
,CenterLossOutputLayer
,Cnn3DLossLayer
,CnnLossLayer
,ComputationGraph
,Convolution1DLayer
,Convolution3DLayer
,ConvolutionLayer
,Cropping1DLayer
,Cropping2DLayer
,Cropping3DLayer
,Deconvolution2DLayer
,Deconvolution3DLayer
,DenseLayer
,DepthwiseConvolution2DLayer
,DropoutLayer
,ElementWiseMultiplicationLayer
,EmbeddingLayer
,EmbeddingSequenceLayer
,FrozenLayer
,FrozenLayerWithBackprop
,GlobalPoolingLayer
,GravesBidirectionalLSTM
,GravesLSTM
,LastTimeStepLayer
,LocalResponseNormalization
,LossLayer
,LSTM
,MaskLayer
,MaskZeroLayer
,MultiLayerNetwork
,OCNNOutputLayer
,OutputLayer
,PReLU
,RepeatVector
,RnnLossLayer
,RnnOutputLayer
,SameDiffLayer
,SameDiffOutputLayer
,SeparableConvolution2DLayer
,SimpleRnn
,SpaceToBatch
,SpaceToDepth
,Subsampling1DLayer
,Subsampling3DLayer
,SubsamplingLayer
,TimeDistributedLayer
,Upsampling1D
,Upsampling2D
,Upsampling3D
,VariationalAutoencoder
,Yolo2OutputLayer
,ZeroPadding1DLayer
,ZeroPadding3DLayer
,ZeroPaddingLayer
public interface Model
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addListeners(TrainingListener... listener)
This method ADDS additional TrainingListener to existing listenersvoid
applyConstraints(int iteration, int epoch)
Apply any constraints to the modelint
batchSize()
The current inputs batch sizevoid
clear()
Clear inputvoid
close()
void
computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the scoreNeuralNetConfiguration
conf()
The configuration for the neural networkvoid
fit()
Deprecated.void
fit(INDArray data, LayerWorkspaceMgr workspaceMgr)
Fit the model to the given dataINDArray
getGradientsViewArray()
ConvexOptimizer
getOptimizer()
Returns this models optimizerINDArray
getParam(String param)
Get the parameterGradient
gradient()
Get the gradient.Pair<Gradient,Double>
gradientAndScore()
Get the gradient and scorevoid
init()
Init the modelINDArray
input()
The input/feature matrix for the modellong
numParams()
the number of parameters for the modellong
numParams(boolean backwards)
the number of parameters for the modelINDArray
params()
Parameters of the model (if any)Map<String,INDArray>
paramTable()
The param tableMap<String,INDArray>
paramTable(boolean backpropParamsOnly)
Table of parameters by key, for backprop For many models (dense layers, etc) - all parameters are backprop parametersdouble
score()
The score for the modelvoid
setBackpropGradientsViewArray(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 configurationvoid
setListeners(Collection<TrainingListener> listeners)
Set the trainingListeners for the ComputationGraph (and all layers in the network)void
setListeners(TrainingListener... listeners)
Set the trainingListeners for the ComputationGraph (and all layers in the network)void
setParam(String key, INDArray val)
Set the parameter with a new ndarrayvoid
setParams(INDArray params)
Set the parameters for this model.void
setParamsViewArray(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(Map<String,INDArray> paramTable)
Setter for the param tablevoid
update(Gradient gradient)
Update layer weights and biases with gradient changevoid
update(INDArray gradient, String paramType)
Perform one update applying the gradient
-
-
-
Method Detail
-
init
void init()
Init the model
-
setListeners
void setListeners(Collection<TrainingListener> listeners)
Set the trainingListeners for the ComputationGraph (and all layers in the network)
-
setListeners
void setListeners(TrainingListener... listeners)
Set the trainingListeners for the ComputationGraph (and all layers in the network)
-
addListeners
void addListeners(TrainingListener... listener)
This method ADDS additional TrainingListener to existing listeners- Parameters:
listener
-
-
fit
@Deprecated void fit()
Deprecated.All models have a fit method
-
update
void update(Gradient gradient)
Update layer weights and biases with gradient change
-
update
void update(INDArray gradient, String paramType)
Perform one update applying the gradient- Parameters:
gradient
- the gradient to apply
-
score
double score()
The score for the model- Returns:
- the score for the model
-
computeGradientAndScore
void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the score
-
params
INDArray params()
Parameters of the model (if any)- Returns:
- the parameters of the model
-
numParams
long numParams()
the number of parameters for the model- Returns:
- the number of parameters for the model
-
numParams
long numParams(boolean backwards)
the number of parameters for the model- Returns:
- the number of parameters for the model
-
setParams
void setParams(INDArray params)
Set the parameters for this model. This expects a linear ndarray which then be unpacked internally relative to the expected ordering of the model- Parameters:
params
- the parameters for the model
-
setParamsViewArray
void setParamsViewArray(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.- Parameters:
params
- a 1 x nParams row vector that is a view of the larger (MLN/CG) parameters array
-
getGradientsViewArray
INDArray getGradientsViewArray()
-
setBackpropGradientsViewArray
void setBackpropGradientsViewArray(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.- Parameters:
gradients
- a 1 x nParams row vector that is a view of the larger (MLN/CG) gradients array
-
fit
void fit(INDArray data, LayerWorkspaceMgr workspaceMgr)
Fit the model to the given data- Parameters:
data
- the data to fit the model to
-
gradient
Gradient gradient()
Get the gradient. Note that this method will not calculate the gradient, it will rather return the gradient that has been computed before. For calculating the gradient, seecomputeGradientAndScore(LayerWorkspaceMgr)
} .- Returns:
- the gradient for this model, as calculated before
-
gradientAndScore
Pair<Gradient,Double> gradientAndScore()
Get the gradient and score- Returns:
- the gradient and score
-
batchSize
int batchSize()
The current inputs batch size- Returns:
- the current inputs batch size
-
conf
NeuralNetConfiguration conf()
The configuration for the neural network- Returns:
- the configuration for the neural network
-
setConf
void setConf(NeuralNetConfiguration conf)
Setter for the configuration- Parameters:
conf
-
-
input
INDArray input()
The input/feature matrix for the model- Returns:
- the input/feature matrix for the model
-
getOptimizer
ConvexOptimizer getOptimizer()
Returns this models optimizer- Returns:
- this models optimizer
-
getParam
INDArray getParam(String param)
Get the parameter- Parameters:
param
- the key of the parameter- Returns:
- the parameter vector/matrix with that particular key
-
paramTable
Map<String,INDArray> paramTable(boolean backpropParamsOnly)
Table of parameters by key, for backprop For many models (dense layers, etc) - all parameters are backprop parameters- Parameters:
backpropParamsOnly
- If true, return backprop params only. If false: return all params (equivalent to paramsTable())
-
setParamTable
void setParamTable(Map<String,INDArray> paramTable)
Setter for the param table- Parameters:
paramTable
-
-
setParam
void setParam(String key, INDArray val)
Set the parameter with a new ndarray- Parameters:
key
- the key to se tval
- the new ndarray
-
clear
void clear()
Clear input
-
applyConstraints
void applyConstraints(int iteration, int epoch)
Apply any constraints to the model
-
close
void close()
-
-