public abstract class BaseLayer extends Object implements Layer
Modifier and Type | Field and Description |
---|---|
protected NeuralNetConfiguration |
conf |
protected org.nd4j.linalg.api.ndarray.INDArray |
dropoutMask |
protected org.nd4j.linalg.api.ndarray.INDArray |
input |
protected ParamInitializer |
paramInitializer |
protected Map<String,org.nd4j.linalg.api.ndarray.INDArray> |
params |
Constructor and Description |
---|
BaseLayer(NeuralNetConfiguration conf) |
BaseLayer(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray input) |
Modifier and Type | Method and Description |
---|---|
org.nd4j.linalg.api.ndarray.INDArray |
activate()
Trigger an activation with the last specified input
|
org.nd4j.linalg.api.ndarray.INDArray |
activate(org.nd4j.linalg.api.ndarray.INDArray input)
Initialize the layer with the given input
and return the activation for this layer
given this input
|
org.nd4j.linalg.api.ndarray.INDArray |
activationMean() |
protected void |
applyDropOutIfNecessary(org.nd4j.linalg.api.ndarray.INDArray input) |
int |
batchSize()
The current inputs batch size
|
Layer |
clone() |
NeuralNetConfiguration |
conf()
The configuration for the neural network
|
protected Gradient |
createGradient(org.nd4j.linalg.api.ndarray.INDArray... gradients)
Create a gradient list based on the passed in parameters.
|
void |
fit()
All models have a fit method
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray input)
Fit the model to the given data
|
org.nd4j.linalg.api.ndarray.INDArray |
getInput() |
org.nd4j.linalg.api.ndarray.INDArray |
getParam(String param)
Get the parameter
|
Pair<Gradient,Double> |
gradientAndScore()
Get the gradient and score
|
void |
initParams()
Initialize the parameters
|
org.nd4j.linalg.api.ndarray.INDArray |
input()
The input/feature matrix for the model
|
void |
merge(Layer l,
int batchSize)
Averages the given logistic regression
from a mini batch in to this one
|
int |
numParams()
The number of parameters for the model
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Returns the parameters of the neural network
|
Map<String,org.nd4j.linalg.api.ndarray.INDArray> |
paramTable()
The param table
|
org.nd4j.linalg.api.ndarray.INDArray |
preOutput(org.nd4j.linalg.api.ndarray.INDArray x)
Classify input
|
void |
setConf(NeuralNetConfiguration conf)
Setter for the configuration
|
void |
setConfiguration(NeuralNetConfiguration conf) |
void |
setInput(org.nd4j.linalg.api.ndarray.INDArray input) |
void |
setParam(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 |
setParamTable(Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable) |
Layer |
transpose()
Return a transposed copy of the weights/bias
(this means reverse the number of inputs and outputs on the weights)
|
void |
validateInput()
Validate the input
|
protected org.nd4j.linalg.api.ndarray.INDArray input
protected NeuralNetConfiguration conf
protected org.nd4j.linalg.api.ndarray.INDArray dropoutMask
protected ParamInitializer paramInitializer
public BaseLayer(NeuralNetConfiguration conf)
public BaseLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public void fit()
Model
public void setConf(NeuralNetConfiguration conf)
Model
public void setParam(String key, org.nd4j.linalg.api.ndarray.INDArray val)
Layer
public org.nd4j.linalg.api.ndarray.INDArray params()
public void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Model
public void initParams()
Layer
initParams
in interface Layer
public Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable()
Layer
paramTable
in interface Layer
public void setParamTable(Map<String,org.nd4j.linalg.api.ndarray.INDArray> paramTable)
setParamTable
in interface Layer
public org.nd4j.linalg.api.ndarray.INDArray getParam(String param)
Layer
public org.nd4j.linalg.api.ndarray.INDArray preOutput(org.nd4j.linalg.api.ndarray.INDArray x)
preOutput
in interface Layer
x
- the input (can either be a matrix or vector)
If it's a matrix, each row is considered an example
and associated rows are classified accordingly.
Each row will be the likelihood of a label given that examplepublic int batchSize()
Model
public org.nd4j.linalg.api.ndarray.INDArray activate()
Layer
public org.nd4j.linalg.api.ndarray.INDArray activate(org.nd4j.linalg.api.ndarray.INDArray input)
Layer
public org.nd4j.linalg.api.ndarray.INDArray activationMean()
activationMean
in interface Layer
public NeuralNetConfiguration conf()
Model
public void setConfiguration(NeuralNetConfiguration conf)
setConfiguration
in interface Layer
public org.nd4j.linalg.api.ndarray.INDArray getInput()
public void setInput(org.nd4j.linalg.api.ndarray.INDArray input)
protected void applyDropOutIfNecessary(org.nd4j.linalg.api.ndarray.INDArray input)
public void merge(Layer l, int batchSize)
public int numParams()
public void fit(org.nd4j.linalg.api.ndarray.INDArray input)
Model
public Pair<Gradient,Double> gradientAndScore()
Model
gradientAndScore
in interface Model
public org.nd4j.linalg.api.ndarray.INDArray input()
Model
public void validateInput()
Model
validateInput
in interface Model
protected Gradient createGradient(org.nd4j.linalg.api.ndarray.INDArray... gradients)
gradients
- the gradients to create fromCopyright © 2015. All rights reserved.