public class OutputLayer extends BaseLayer implements Serializable, Classifier
Layer.Type
conf, dropoutMask, input, iterationListeners, optimizer, paramInitializer, params, score
Constructor and Description |
---|
OutputLayer(NeuralNetConfiguration conf) |
OutputLayer(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray input) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear input
|
void |
fit(org.nd4j.linalg.dataset.api.DataSet data)
Fit the model
|
void |
fit(org.nd4j.linalg.dataset.api.iterator.DataSetIterator iter) |
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,
int[] labels)
Fit the model
|
org.nd4j.linalg.api.ndarray.INDArray |
getLabels() |
Gradient |
gradient()
Gets the gradient from one training iteration
|
Pair<Gradient,Double> |
gradientAndScore()
Get the gradient and score
|
void |
iterate(org.nd4j.linalg.api.ndarray.INDArray input)
iterate one iteration of the network
|
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
|
int |
numLabels()
Returns the number of possible labels
|
org.nd4j.linalg.api.ndarray.INDArray |
output(org.nd4j.linalg.api.ndarray.INDArray x)
Classify input
|
int[] |
predict(org.nd4j.linalg.api.ndarray.INDArray d)
Returns the predictions for each example in the dataset
|
double |
score()
Objective function: the specified objective
|
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.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Returns the f1 score for the given examples.
|
void |
setLabels(org.nd4j.linalg.api.ndarray.INDArray labels) |
void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Set the parameters for this model.
|
void |
setScore()
Update the score
|
org.nd4j.linalg.api.ndarray.INDArray |
transform(org.nd4j.linalg.api.ndarray.INDArray data)
Transform the data based on the model's output.
|
accumulateScore, activate, activate, activationMean, applyDropOutIfNecessary, backWard, backwardGradient, batchSize, calcGradient, clone, conf, createGradient, derivativeActivation, error, errorSignal, fit, getIterationListeners, getOptimizer, getParam, initParams, input, merge, numParams, params, paramTable, preOutput, setConf, setIterationListeners, setParam, setParamTable, transpose, type, update, validateInput
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accumulateScore, batchSize, conf, fit, getOptimizer, getParam, initParams, input, numParams, params, paramTable, setConf, setParam, setParamTable, update, validateInput
public OutputLayer(NeuralNetConfiguration conf)
public OutputLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public double score()
public void setScore()
Model
public Gradient gradient()
public Pair<Gradient,Double> gradientAndScore()
Model
gradientAndScore
in interface Model
gradientAndScore
in class BaseLayer
public double score(org.nd4j.linalg.dataset.api.DataSet data)
score
in interface Classifier
data
- the data to scorepublic double score(org.nd4j.linalg.api.ndarray.INDArray examples, org.nd4j.linalg.api.ndarray.INDArray labels)
score
in interface Classifier
examples
- te the examples to classify (one example in each row)labels
- the true labelspublic int numLabels()
numLabels
in interface Classifier
public void fit(org.nd4j.linalg.dataset.api.iterator.DataSetIterator iter)
fit
in interface Classifier
public 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 void clear()
Model
public org.nd4j.linalg.api.ndarray.INDArray transform(org.nd4j.linalg.api.ndarray.INDArray data)
public void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
public void fit(org.nd4j.linalg.api.ndarray.INDArray data)
public void iterate(org.nd4j.linalg.api.ndarray.INDArray input)
BaseLayer
public org.nd4j.linalg.api.ndarray.INDArray output(org.nd4j.linalg.api.ndarray.INDArray x)
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 org.nd4j.linalg.api.ndarray.INDArray getLabels()
public void setLabels(org.nd4j.linalg.api.ndarray.INDArray labels)
Copyright © 2015. All Rights Reserved.