public abstract class BaseMultiLayerNetwork extends Object implements Serializable, Persistable, Classifier
Modifier and Type | Class and Description |
---|---|
static class |
BaseMultiLayerNetwork.Builder<E extends BaseMultiLayerNetwork> |
static class |
BaseMultiLayerNetwork.ParamRange |
Modifier and Type | Field and Description |
---|---|
protected double |
dampingFactor |
protected NeuralNetConfiguration |
defaultConfiguration |
protected double |
errorTolerance |
protected boolean |
forceNumEpochs |
protected Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> |
hiddenBiasTransforms |
protected int[] |
hiddenLayerSizes |
protected boolean |
initCalled |
protected org.nd4j.linalg.api.ndarray.INDArray |
input |
protected org.nd4j.linalg.api.ndarray.INDArray |
labels |
protected Layer[] |
layers |
protected List<NeuralNetConfiguration> |
layerWiseConfigurations |
protected double |
learningRateUpdate |
protected boolean |
lineSearchBackProp
Whether to use conjugate gradient line search for back prop or
normal SGD backprop
|
protected org.nd4j.linalg.api.ndarray.INDArray |
mask |
protected NeuralNetwork[] |
neuralNets |
protected MultiLayerNetworkOptimizer |
optimizer |
protected boolean |
sampleFromHiddenActivations |
protected boolean |
shouldBackProp |
protected boolean |
useDropConnect |
protected boolean |
useGaussNewtonVectorProductBackProp |
protected Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> |
visibleBiasTransforms |
protected Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> |
weightTransforms |
Modifier | Constructor and Description |
---|---|
protected |
BaseMultiLayerNetwork() |
protected |
BaseMultiLayerNetwork(int[] hiddenLayerSizes,
int nLayers) |
protected |
BaseMultiLayerNetwork(int[] hiddenLayerSizes,
int nLayers,
org.nd4j.linalg.api.ndarray.INDArray input,
org.nd4j.linalg.api.ndarray.INDArray labels) |
Modifier and Type | Method and Description |
---|---|
org.nd4j.linalg.api.ndarray.INDArray |
activate()
Triggers the activation of the last hidden layer ie: not logistic regression
|
org.nd4j.linalg.api.ndarray.INDArray |
activate(int layer)
Triggers the activation for a given layer
|
org.nd4j.linalg.api.ndarray.INDArray |
activate(int layer,
org.nd4j.linalg.api.ndarray.INDArray input)
Triggers the activation of the given layer
|
org.nd4j.linalg.api.ndarray.INDArray |
activationFromPrevLayer(int curr,
org.nd4j.linalg.api.ndarray.INDArray input) |
protected void |
applyDropConnectIfNecessary(org.nd4j.linalg.api.ndarray.INDArray input)
Applies drop connect relative to connections.
|
protected void |
applyTransforms() |
void |
backProp(double lr,
int epochs)
Backpropagation of errors for weights
|
void |
backProp(double lr,
int epochs,
TrainingEvaluator eval)
Backpropagation of errors for weights
|
protected List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> |
backPropGradient()
Do a back prop iteration.
|
protected List<Pair<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>,Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>>> |
backPropGradient2()
Do a back prop iteration.
|
protected List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> |
backPropGradientR(org.nd4j.linalg.api.ndarray.INDArray v)
Do a back prop iteration.
|
void |
backPropStep()
One step of back prop
|
void |
backPropStepR(org.nd4j.linalg.api.ndarray.INDArray v)
One step of back prop with the R operator
|
void |
clearInput()
Clears the input from all of the neuralNets
|
BaseMultiLayerNetwork |
clone() |
protected void |
computeDeltas(List<org.nd4j.linalg.api.ndarray.INDArray> deltaRet) |
protected List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> |
computeDeltas2() |
protected List<org.nd4j.linalg.api.ndarray.INDArray> |
computeDeltasR(org.nd4j.linalg.api.ndarray.INDArray v) |
Layer |
createHiddenLayer(int index,
org.nd4j.linalg.api.ndarray.INDArray layerInput)
Creates a hidden layer with the given parameters.
|
abstract NeuralNetwork |
createLayer(org.nd4j.linalg.api.ndarray.INDArray input,
org.nd4j.linalg.api.ndarray.INDArray W,
org.nd4j.linalg.api.ndarray.INDArray hbias,
org.nd4j.linalg.api.ndarray.INDArray vBias,
int index)
Creates a layer depending on the index.
|
abstract NeuralNetwork[] |
createNetworkLayers(int numLayers) |
void |
dampingUpdate(double rho,
double boost,
double decrease) |
void |
dimensionCheck() |
List<org.nd4j.linalg.api.ndarray.INDArray> |
feedForward()
Compute activations from input to output of the output layer
|
List<org.nd4j.linalg.api.ndarray.INDArray> |
feedForward(org.nd4j.linalg.api.ndarray.INDArray input)
Compute activations from input to output of the output layer
|
List<org.nd4j.linalg.api.ndarray.INDArray> |
feedForwardR(org.nd4j.linalg.api.ndarray.INDArray v)
Feed forward with the r operator
|
List<org.nd4j.linalg.api.ndarray.INDArray> |
feedForwardR(List<org.nd4j.linalg.api.ndarray.INDArray> acts,
org.nd4j.linalg.api.ndarray.INDArray v)
Feed forward with the r operator
|
void |
finetune(DataSetIterator iter,
double lr,
int iterations)
Run SGD based on the given labels
|
void |
finetune(DataSetIterator iter,
double lr,
int iterations,
TrainingEvaluator eval)
Run training algorithm based on the datastet iterator
|
void |
finetune(double lr,
int epochs)
Finetunes with the current cached labels
|
void |
finetune(org.nd4j.linalg.api.ndarray.INDArray labels,
double lr,
int iterations)
Run SGD based on the given labels
|
void |
finetune(org.nd4j.linalg.api.ndarray.INDArray labels,
double lr,
int iterations,
TrainingEvaluator eval)
Run training algorithm based on the given labels
|
void |
fit(org.nd4j.linalg.dataset.api.DataSet data)
Fit the model
|
void |
fit(org.nd4j.linalg.dataset.api.DataSet data,
Object[] params)
Fit the model
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray data)
Fit the model to the given data
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Fit the model
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels,
Object[] params)
Fit the model
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray examples,
int[] labels)
Fit the model
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray examples,
int[] labels,
Object[] params)
Fit the model
|
Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> |
getBackPropGradient2()
Gets the back prop gradient with the r operator (gauss vector)
and the associated precon matrix
This is also called computeGV
|
org.nd4j.linalg.api.ndarray.INDArray |
getBackPropRGradient(org.nd4j.linalg.api.ndarray.INDArray v)
Gets the back prop gradient with the r operator (gauss vector)
This is also called computeGV
|
NeuralNetConfiguration |
getDefaultConfiguration() |
Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> |
getHiddenBiasTransforms() |
int[] |
getHiddenLayerSizes() |
org.nd4j.linalg.api.ndarray.INDArray |
getInput() |
org.nd4j.linalg.api.ndarray.INDArray |
getLabels() |
Layer[] |
getLayers() |
List<NeuralNetConfiguration> |
getLayerWiseConfigurations() |
org.nd4j.linalg.api.ndarray.INDArray |
getMask() |
NeuralNetwork[] |
getNeuralNets() |
int |
getnLayers() |
OutputLayer |
getOutputLayer() |
Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> |
getVisibleBiasTransforms() |
Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> |
getWeightTransforms() |
void |
init() |
void |
initialize(org.nd4j.linalg.dataset.DataSet data)
Sets the input and labels from this dataset
|
void |
initializeLayers(org.nd4j.linalg.api.ndarray.INDArray input)
Base class for initializing the neuralNets based on the input.
|
protected void |
intializeConfigurations() |
boolean |
isForceNumEpochs() |
boolean |
isLineSearchBackProp() |
boolean |
isSampleFromHiddenActivations() |
boolean |
isShouldBackProp() |
boolean |
isUseDropConnect() |
boolean |
isUseGaussNewtonVectorProductBackProp() |
void |
iterate(org.nd4j.linalg.api.ndarray.INDArray examples,
int[] labels,
Object[] params)
Iterate once on the model
|
void |
iterate(org.nd4j.linalg.api.ndarray.INDArray input,
Object[] params)
Run one iteration
|
org.nd4j.linalg.api.ndarray.INDArray |
labelProbabilities(org.nd4j.linalg.api.ndarray.INDArray examples)
Returns the probabilities for each label
for each example row wise
|
void |
load(InputStream is)
Load (using
ObjectInputStream |
void |
merge(BaseMultiLayerNetwork network,
int batchSize)
Merges this network with the other one.
|
int |
numLabels()
Returns the number of possible labels
|
int |
numParams()
Returns a 1 x m vector where the vector is composed of
a flattened vector of all of the weights for the
various neuralNets and output layer
|
org.nd4j.linalg.api.ndarray.INDArray |
output(org.nd4j.linalg.api.ndarray.INDArray x)
Label the probabilities of the input
|
org.nd4j.linalg.api.ndarray.INDArray |
pack()
Packs a set of matrices in to one vector,
where the matrices in this case are the w,hbias at each layer
and the output layer w,bias
|
org.nd4j.linalg.api.ndarray.INDArray |
pack(List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> layers)
Packs a set of matrices in to one vector
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Returns a 1 x m vector where the vector is composed of
a flattened vector of all of the weights for the
various neuralNets(w,hbias NOT VBIAS) and output layer
|
int[] |
predict(org.nd4j.linalg.api.ndarray.INDArray d)
Returns the predictions for each example in the dataset
|
abstract void |
pretrain(DataSetIterator iter,
Object[] otherParams) |
abstract void |
pretrain(org.nd4j.linalg.api.ndarray.INDArray input,
Object[] otherParams) |
void |
printConfiguration()
Prints the configuration
|
org.nd4j.linalg.api.ndarray.INDArray |
reconstruct(org.nd4j.linalg.api.ndarray.INDArray x,
int layerNum)
Reconstructs the input.
|
double |
reductionRatio(org.nd4j.linalg.api.ndarray.INDArray p,
double currScore,
double score,
org.nd4j.linalg.api.ndarray.INDArray gradient) |
double |
score()
Score of the model (relative to the objective function)
|
double |
score(org.nd4j.linalg.dataset.api.DataSet data)
Sets the input and labels and returns a score for the prediction
wrt true labels
|
double |
score(org.nd4j.linalg.dataset.DataSet data)
Sets the input and labels and returns a score for the prediction
wrt true labels
|
double |
score(org.nd4j.linalg.api.ndarray.INDArray param)
Score of the model (relative to the objective function)
|
double |
score(org.nd4j.linalg.api.ndarray.INDArray input,
org.nd4j.linalg.api.ndarray.INDArray labels)
Sets the input and labels and returns a score for the prediction
wrt true labels
|
void |
setDefaultConfiguration(NeuralNetConfiguration defaultConfiguration) |
void |
setForceNumEpochs(boolean forceNumEpochs) |
void |
setHiddenLayerSizes(int[] hiddenLayerSizes) |
void |
setInput(org.nd4j.linalg.api.ndarray.INDArray input)
Note that if input isn't null
and the neuralNets are null, this is a way
of initializing the neural network
|
void |
setLabels(org.nd4j.linalg.api.ndarray.INDArray labels) |
void |
setLayers(Layer[] layers) |
void |
setLayers(NeuralNetwork[] layers) |
void |
setLayerWiseConfigurations(List<NeuralNetConfiguration> layerWiseConfigurations) |
void |
setLineSearchBackProp(boolean lineSearchBackProp) |
void |
setMask(org.nd4j.linalg.api.ndarray.INDArray mask) |
void |
setNeuralNets(NeuralNetwork[] neuralNets) |
void |
setnLayers(int nLayers) |
void |
setParameters(org.nd4j.linalg.api.ndarray.INDArray params)
Sets parameters for the model.
|
void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Set the parameters for this model.
|
void |
setSampleFromHiddenActivations(boolean sampleFromHiddenActivations) |
void |
setShouldBackProp(boolean shouldBackProp) |
void |
setUseDropConnect(boolean useDropConnect) |
void |
setUseGaussNewtonVectorProductBackProp(boolean useGaussNewtonVectorProductBackProp) |
BaseMultiLayerNetwork.ParamRange |
startIndexForLayer(int layer)
Returns a start index for a given layer (neural net or outputlayer)
|
org.nd4j.linalg.api.ndarray.INDArray |
transform(org.nd4j.linalg.api.ndarray.INDArray data)
Transform the data based on the model's output.
|
List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> |
unPack(org.nd4j.linalg.api.ndarray.INDArray param)
Unpacks a parameter matrix in to a
applyTransformToDestination of pairs(w,hbias)
triples with layer wise
|
void |
update(BaseMultiLayerNetwork network)
Assigns the parameters of this model to the ones specified by this
network.
|
List<org.nd4j.linalg.api.ndarray.INDArray> |
weightMatrices() |
void |
write(OutputStream os) |
protected int[] hiddenLayerSizes
protected Layer[] layers
protected org.nd4j.linalg.api.ndarray.INDArray input
protected org.nd4j.linalg.api.ndarray.INDArray labels
protected MultiLayerNetworkOptimizer optimizer
protected Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> weightTransforms
protected Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> hiddenBiasTransforms
protected Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> visibleBiasTransforms
protected boolean shouldBackProp
protected boolean forceNumEpochs
protected boolean initCalled
protected boolean sampleFromHiddenActivations
protected NeuralNetConfiguration defaultConfiguration
protected List<NeuralNetConfiguration> layerWiseConfigurations
protected double learningRateUpdate
protected NeuralNetwork[] neuralNets
protected double errorTolerance
protected boolean lineSearchBackProp
protected org.nd4j.linalg.api.ndarray.INDArray mask
protected boolean useDropConnect
protected double dampingFactor
protected boolean useGaussNewtonVectorProductBackProp
protected BaseMultiLayerNetwork()
protected BaseMultiLayerNetwork(int[] hiddenLayerSizes, int nLayers)
protected BaseMultiLayerNetwork(int[] hiddenLayerSizes, int nLayers, org.nd4j.linalg.api.ndarray.INDArray input, org.nd4j.linalg.api.ndarray.INDArray labels)
protected void intializeConfigurations()
public void dimensionCheck()
public org.nd4j.linalg.api.ndarray.INDArray transform(org.nd4j.linalg.api.ndarray.INDArray data)
public NeuralNetConfiguration getDefaultConfiguration()
public void setDefaultConfiguration(NeuralNetConfiguration defaultConfiguration)
public List<NeuralNetConfiguration> getLayerWiseConfigurations()
public void setLayerWiseConfigurations(List<NeuralNetConfiguration> layerWiseConfigurations)
public void initializeLayers(org.nd4j.linalg.api.ndarray.INDArray input)
input
- the input matrix for trainingpublic void init()
public org.nd4j.linalg.api.ndarray.INDArray activate()
public org.nd4j.linalg.api.ndarray.INDArray activate(int layer)
layer
- the layer to activate onpublic org.nd4j.linalg.api.ndarray.INDArray activate(int layer, org.nd4j.linalg.api.ndarray.INDArray input)
layer
- the layer to trigger oninput
- the input to the hidden layerpublic void finetune(double lr, int epochs)
lr
- the learning rate to useepochs
- the max number of epochs to finetune withpublic void initialize(org.nd4j.linalg.dataset.DataSet data)
data
- the dataset to initialize withpublic org.nd4j.linalg.api.ndarray.INDArray activationFromPrevLayer(int curr, org.nd4j.linalg.api.ndarray.INDArray input)
public List<org.nd4j.linalg.api.ndarray.INDArray> feedForward()
public List<org.nd4j.linalg.api.ndarray.INDArray> feedForward(org.nd4j.linalg.api.ndarray.INDArray input)
protected void applyDropConnectIfNecessary(org.nd4j.linalg.api.ndarray.INDArray input)
input
- the input to apply drop connect toprotected List<org.nd4j.linalg.api.ndarray.INDArray> computeDeltasR(org.nd4j.linalg.api.ndarray.INDArray v)
public void dampingUpdate(double rho, double boost, double decrease)
public double reductionRatio(org.nd4j.linalg.api.ndarray.INDArray p, double currScore, double score, org.nd4j.linalg.api.ndarray.INDArray gradient)
protected List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> computeDeltas2()
public void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
public void fit(org.nd4j.linalg.api.ndarray.INDArray data)
protected void computeDeltas(List<org.nd4j.linalg.api.ndarray.INDArray> deltaRet)
public void backPropStep()
public void backPropStepR(org.nd4j.linalg.api.ndarray.INDArray v)
v
- for gaussian vector, this is for g * v. This is optional.public Layer[] getLayers()
public void setLayers(Layer[] layers)
public void setNeuralNets(NeuralNetwork[] neuralNets)
public org.nd4j.linalg.api.ndarray.INDArray getBackPropRGradient(org.nd4j.linalg.api.ndarray.INDArray v)
v
- the v in gaussian newton vector g * vpublic Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray> getBackPropGradient2()
public BaseMultiLayerNetwork clone()
public List<org.nd4j.linalg.api.ndarray.INDArray> weightMatrices()
public List<org.nd4j.linalg.api.ndarray.INDArray> feedForwardR(List<org.nd4j.linalg.api.ndarray.INDArray> acts, org.nd4j.linalg.api.ndarray.INDArray v)
v
- the v for the r operatorpublic List<org.nd4j.linalg.api.ndarray.INDArray> feedForwardR(org.nd4j.linalg.api.ndarray.INDArray v)
v
- the v for the r operatorpublic void backProp(double lr, int epochs, TrainingEvaluator eval)
lr
- the learning rate to useepochs
- the number of epochs to iterate (this is already called in finetune)eval
- the evaluator for stoppingpublic void backProp(double lr, int epochs)
lr
- the learning rate to useepochs
- the number of epochs to iterate (this is already called in finetune)public boolean isUseDropConnect()
public void setUseDropConnect(boolean useDropConnect)
public org.nd4j.linalg.api.ndarray.INDArray params()
public int numParams()
public org.nd4j.linalg.api.ndarray.INDArray pack()
public org.nd4j.linalg.api.ndarray.INDArray pack(List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> layers)
layers
- the neuralNets to packpublic double score(org.nd4j.linalg.dataset.api.DataSet data)
score
in interface Classifier
data
- the data to scoreprotected List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> backPropGradient()
public List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> unPack(org.nd4j.linalg.api.ndarray.INDArray param)
param
- the param vectorprotected List<Pair<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>,Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>>> backPropGradient2()
protected List<Pair<org.nd4j.linalg.api.ndarray.INDArray,org.nd4j.linalg.api.ndarray.INDArray>> backPropGradientR(org.nd4j.linalg.api.ndarray.INDArray v)
v
- the v in gaussian newton vector g * vpublic void finetune(DataSetIterator iter, double lr, int iterations)
iter
- fine tune based on the labelslr
- the learning rate during trainingiterations
- the number of times to iteratepublic void finetune(DataSetIterator iter, double lr, int iterations, TrainingEvaluator eval)
iter
- the labels to uselr
- the learning rate during trainingiterations
- the number of times to iteratepublic void finetune(org.nd4j.linalg.api.ndarray.INDArray labels, double lr, int iterations)
labels
- the labels to uselr
- the learning rate during trainingiterations
- the number of times to iteratepublic void finetune(org.nd4j.linalg.api.ndarray.INDArray labels, double lr, int iterations, TrainingEvaluator eval)
labels
- the labels to uselr
- the learning rate during trainingiterations
- the number of times to iteratepublic int[] predict(org.nd4j.linalg.api.ndarray.INDArray d)
predict
in interface Classifier
d
- the matrix to predictpublic org.nd4j.linalg.api.ndarray.INDArray labelProbabilities(org.nd4j.linalg.api.ndarray.INDArray examples)
labelProbabilities
in interface Classifier
examples
- the examples to classify (one example in each row)public void fit(org.nd4j.linalg.api.ndarray.INDArray examples, org.nd4j.linalg.api.ndarray.INDArray labels)
fit
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the example labels(a binary outcome matrix)public void fit(org.nd4j.linalg.dataset.api.DataSet data)
fit
in interface Classifier
data
- the data to train onpublic void fit(org.nd4j.linalg.api.ndarray.INDArray examples, int[] labels)
fit
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the labels for each example (the number of labels must matchpublic org.nd4j.linalg.api.ndarray.INDArray output(org.nd4j.linalg.api.ndarray.INDArray x)
x
- the input to labelpublic org.nd4j.linalg.api.ndarray.INDArray reconstruct(org.nd4j.linalg.api.ndarray.INDArray x, int layerNum)
x
- the input to transformlayerNum
- the layer to output for encodingpublic void printConfiguration()
public void write(OutputStream os)
write
in interface Persistable
public void load(InputStream is)
ObjectInputStream
load
in interface Persistable
is
- the input stream to load from (usually a file)public void update(BaseMultiLayerNetwork network)
network
- the network to getFromOrigin parameters frompublic double score(org.nd4j.linalg.api.ndarray.INDArray input, org.nd4j.linalg.api.ndarray.INDArray labels)
score
in interface Classifier
input
- the input to scorelabels
- the true labelspublic int numLabels()
numLabels
in interface Classifier
public double score(org.nd4j.linalg.dataset.DataSet data)
data
- the data to scorepublic double score()
score
in interface Classifier
score
in interface Model
public double score(org.nd4j.linalg.api.ndarray.INDArray param)
param
- the current parametersprotected void applyTransforms()
public abstract NeuralNetwork createLayer(org.nd4j.linalg.api.ndarray.INDArray input, org.nd4j.linalg.api.ndarray.INDArray W, org.nd4j.linalg.api.ndarray.INDArray hbias, org.nd4j.linalg.api.ndarray.INDArray vBias, int index)
DBN
where the first layer needs to be an RBM
for continuous inputs.input
- the input to the layerW
- the weight vectorhbias
- the hidden biasvBias
- the visible biasindex
- the index of the layerRBM
public abstract void pretrain(DataSetIterator iter, Object[] otherParams)
public abstract void pretrain(org.nd4j.linalg.api.ndarray.INDArray input, Object[] otherParams)
public abstract NeuralNetwork[] createNetworkLayers(int numLayers)
public Layer createHiddenLayer(int index, org.nd4j.linalg.api.ndarray.INDArray layerInput)
layerInput
- the layer starting input
for generating weightspublic void merge(BaseMultiLayerNetwork network, int batchSize)
network
- the network to merge withbatchSize
- the batch size (number of training examples)
to average bypublic org.nd4j.linalg.api.ndarray.INDArray getLabels()
public void setInput(org.nd4j.linalg.api.ndarray.INDArray input)
input
- public boolean isShouldBackProp()
public org.nd4j.linalg.api.ndarray.INDArray getInput()
public NeuralNetwork[] getNeuralNets()
public boolean isForceNumEpochs()
public int[] getHiddenLayerSizes()
public void setHiddenLayerSizes(int[] hiddenLayerSizes)
public Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> getWeightTransforms()
public void setLabels(org.nd4j.linalg.api.ndarray.INDArray labels)
public void setForceNumEpochs(boolean forceNumEpochs)
public boolean isSampleFromHiddenActivations()
public void setSampleFromHiddenActivations(boolean sampleFromHiddenActivations)
public Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> getHiddenBiasTransforms()
public Map<Integer,org.nd4j.linalg.transformation.MatrixTransform> getVisibleBiasTransforms()
public int getnLayers()
public void setnLayers(int nLayers)
public void setShouldBackProp(boolean shouldBackProp)
public void setLayers(NeuralNetwork[] layers)
public boolean isUseGaussNewtonVectorProductBackProp()
public void setUseGaussNewtonVectorProductBackProp(boolean useGaussNewtonVectorProductBackProp)
public org.nd4j.linalg.api.ndarray.INDArray getMask()
public void setMask(org.nd4j.linalg.api.ndarray.INDArray mask)
public void clearInput()
public OutputLayer getOutputLayer()
public boolean isLineSearchBackProp()
public void setLineSearchBackProp(boolean lineSearchBackProp)
public void setParameters(org.nd4j.linalg.api.ndarray.INDArray params)
params
- a parameter vector equal 1,numParameterspublic BaseMultiLayerNetwork.ParamRange startIndexForLayer(int layer)
layer
- the layer to getFromOrigin the index forpublic void iterate(org.nd4j.linalg.api.ndarray.INDArray input, Object[] params)
public void fit(org.nd4j.linalg.api.ndarray.INDArray examples, org.nd4j.linalg.api.ndarray.INDArray labels, Object[] params)
fit
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the example labels(a binary outcome matrix)params
- extra parameterspublic void fit(org.nd4j.linalg.dataset.api.DataSet data, Object[] params)
fit
in interface Classifier
data
- the data to train onparams
- extra parameterspublic void fit(org.nd4j.linalg.api.ndarray.INDArray examples, int[] labels, Object[] params)
fit
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the labels for each example (the number of labels must match
the number of rows in the exampleparams
- extra parameterspublic void iterate(org.nd4j.linalg.api.ndarray.INDArray examples, int[] labels, Object[] params)
iterate
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the labels for each example (the number of labels must match
the number of rows in the exampleparams
- extra parametersCopyright © 2014. All rights reserved.