public abstract class TrainingMetric
extends java.lang.Object
implements java.lang.Cloneable
Training metrics can be used to evaluate the performance of a model. They can all be monitored
to make an assessment about the performance of the model. However, only ones that further extend
Loss are suited to being used to directly optimize a model.
| Constructor and Description |
|---|
TrainingMetric(java.lang.String name)
Creates a metric with abstract update methods.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkLabelShapes(NDArray labels,
NDArray predictions)
Checks the length of NDArrays.
|
protected void |
checkLabelShapes(NDArray labels,
NDArray predictions,
boolean checkDimOnly)
Checks if the two input
NDArray have the same length or shape. |
TrainingMetric |
duplicate()
Creates and returns a copy of this object.
|
java.lang.String |
getName()
Gets the name of this
TrainingMetric. |
abstract float |
getValue()
Calculates metric values.
|
abstract void |
reset()
Resets metric values.
|
abstract void |
update(NDList labels,
NDList predictions)
Computes and updates the training metrics based on the labels and predictions.
|
public TrainingMetric(java.lang.String name)
name - the name of the metricpublic TrainingMetric duplicate()
TrainingMetricpublic abstract void update(NDList labels, NDList predictions)
labels - a NDList of labelspredictions - a NDList of predictionspublic abstract void reset()
public java.lang.String getName()
TrainingMetric.TrainingMetricpublic abstract float getValue()
Pair of metric name and valueprotected void checkLabelShapes(NDArray labels, NDArray predictions, boolean checkDimOnly)
NDArray have the same length or shape.labels - a NDArray of labelspredictions - a NDArray of predictionscheckDimOnly - whether to check for first dimension only