Package org.nd4j.autodiff.listeners.impl
Class ScoreListener
- java.lang.Object
-
- org.nd4j.autodiff.listeners.BaseListener
-
- org.nd4j.autodiff.listeners.impl.ScoreListener
-
- All Implemented Interfaces:
Listener
public class ScoreListener extends BaseListener
-
-
Field Summary
Fields Modifier and Type Field Description protected static ThreadLocal<DecimalFormat>DF_2DPprotected static ThreadLocal<DecimalFormat>DF_2DP_SCIprotected static ThreadLocal<DecimalFormat>DF_5DPprotected static ThreadLocal<DecimalFormat>DF_5DP_SCI
-
Constructor Summary
Constructors Constructor Description ScoreListener()Create a ScoreListener reporting every 10 iterations, and at the end of each epochScoreListener(int frequency)Create a ScoreListener reporting every N iterations, and at the end of each epochScoreListener(int frequency, boolean reportEpochs)Create a ScoreListener reporting every N iterations, and optionally at the end of each epochScoreListener(int frequency, boolean reportEpochs, boolean reportIterPerformance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListenerResponseepochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis)Called at the end of every epoch, when fitting from an iteratorvoidepochStart(SameDiff sd, At at)Called at the start of every epoch, when fitting from an iteratorprotected Stringformat2dp(double d)protected Stringformat5dp(double d)protected StringformatDurationMs(long ms)booleanisActive(Operation operation)Returns whether this listener is active during the given operation.voiditerationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss)Called at the end of every iteration, after all operations (including updating parameters) has been completedvoiditerationStart(SameDiff sd, At at, MultiDataSet data, long etlMs)Called at the start of every iteration (minibatch), before any operations have been executed-
Methods inherited from class org.nd4j.autodiff.listeners.BaseListener
activationAvailable, operationEnd, operationStart, opExecution, preOpExecution, preUpdate, requiredVariables, validationDone
-
-
-
-
Field Detail
-
DF_2DP
protected static final ThreadLocal<DecimalFormat> DF_2DP
-
DF_2DP_SCI
protected static final ThreadLocal<DecimalFormat> DF_2DP_SCI
-
DF_5DP
protected static final ThreadLocal<DecimalFormat> DF_5DP
-
DF_5DP_SCI
protected static final ThreadLocal<DecimalFormat> DF_5DP_SCI
-
-
Constructor Detail
-
ScoreListener
public ScoreListener()
Create a ScoreListener reporting every 10 iterations, and at the end of each epoch
-
ScoreListener
public ScoreListener(int frequency)
Create a ScoreListener reporting every N iterations, and at the end of each epoch
-
ScoreListener
public ScoreListener(int frequency, boolean reportEpochs)Create a ScoreListener reporting every N iterations, and optionally at the end of each epoch
-
ScoreListener
public ScoreListener(int frequency, boolean reportEpochs, boolean reportIterPerformance)
-
-
Method Detail
-
isActive
public boolean isActive(Operation operation)
Description copied from interface:ListenerReturns whether this listener is active during the given operation. If this returns false for the given operation, those listener methods will not be called.
-
epochStart
public void epochStart(SameDiff sd, At at)
Description copied from interface:ListenerCalled at the start of every epoch, when fitting from an iterator- Specified by:
epochStartin interfaceListener- Overrides:
epochStartin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etc
-
epochEnd
public ListenerResponse epochEnd(SameDiff sd, At at, LossCurve lossCurve, long epochTimeMillis)
Description copied from interface:ListenerCalled at the end of every epoch, when fitting from an iterator- Specified by:
epochEndin interfaceListener- Overrides:
epochEndin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etclossCurve- The losses so farepochTimeMillis- How long this epoch took- Returns:
- ListenerResponse.STOP to stop training, CONTINUE or null to continue
-
iterationStart
public void iterationStart(SameDiff sd, At at, MultiDataSet data, long etlMs)
Description copied from interface:ListenerCalled at the start of every iteration (minibatch), before any operations have been executed- Specified by:
iterationStartin interfaceListener- Overrides:
iterationStartin classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etc
-
iterationDone
public void iterationDone(SameDiff sd, At at, MultiDataSet dataSet, Loss loss)
Description copied from interface:ListenerCalled at the end of every iteration, after all operations (including updating parameters) has been completed- Specified by:
iterationDonein interfaceListener- Overrides:
iterationDonein classBaseListener- Parameters:
sd- The SameDiff instanceat- Current iteration/epoch etcdataSet- The current dataset (minibatch) used for trainingloss- The loss value for the current minibatch. Will be null except for during training
-
formatDurationMs
protected String formatDurationMs(long ms)
-
format2dp
protected String format2dp(double d)
-
format5dp
protected String format5dp(double d)
-
-