public class OutputLayer extends BaseLayer implements Serializable, Classifier
conf, dropoutMask, input, paramInitializer, params
Constructor and Description |
---|
OutputLayer(NeuralNetConfiguration conf) |
OutputLayer(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray input) |
Modifier and Type | Method and Description |
---|---|
void |
fit(org.nd4j.linalg.dataset.api.DataSet data)
Fit the model
|
void |
fit(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
|
Gradient |
getGradient()
Gets the gradient from one training iteration
|
org.nd4j.linalg.api.ndarray.INDArray |
getLabels() |
Pair<Gradient,Double> |
gradientAndScore()
Get the gradient and score
|
void |
iterate(org.nd4j.linalg.api.ndarray.INDArray input)
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
|
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.
|
org.nd4j.linalg.api.ndarray.INDArray |
transform(org.nd4j.linalg.api.ndarray.INDArray data)
Transform the data based on the model's output.
|
void |
update(Gradient gradient)
Perform one update applying the gradient
|
activate, activate, activationMean, applyDropOutIfNecessary, batchSize, clone, conf, createGradient, fit, getInput, getParam, initParams, input, merge, numParams, params, paramTable, preOutput, setConf, setConfiguration, setInput, setParam, setParamTable, transpose, validateInput
public OutputLayer(NeuralNetConfiguration conf)
public OutputLayer(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public void update(Gradient gradient)
Model
public double score()
public Gradient getGradient()
getGradient
in interface Model
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(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 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)
Model
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.