Class ScoreListener

    • 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: Listener
        Returns 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: Listener
        Called at the start of every epoch, when fitting from an iterator
        Specified by:
        epochStart in interface Listener
        Overrides:
        epochStart in class BaseListener
        Parameters:
        sd - The SameDiff instance
        at - Current iteration/epoch etc
      • epochEnd

        public ListenerResponse epochEnd​(SameDiff sd,
                                         At at,
                                         LossCurve lossCurve,
                                         long epochTimeMillis)
        Description copied from interface: Listener
        Called at the end of every epoch, when fitting from an iterator
        Specified by:
        epochEnd in interface Listener
        Overrides:
        epochEnd in class BaseListener
        Parameters:
        sd - The SameDiff instance
        at - Current iteration/epoch etc
        lossCurve - The losses so far
        epochTimeMillis - 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: Listener
        Called at the start of every iteration (minibatch), before any operations have been executed
        Specified by:
        iterationStart in interface Listener
        Overrides:
        iterationStart in class BaseListener
        Parameters:
        sd - The SameDiff instance
        at - Current iteration/epoch etc
      • iterationDone

        public void iterationDone​(SameDiff sd,
                                  At at,
                                  MultiDataSet dataSet,
                                  Loss loss)
        Description copied from interface: Listener
        Called at the end of every iteration, after all operations (including updating parameters) has been completed
        Specified by:
        iterationDone in interface Listener
        Overrides:
        iterationDone in class BaseListener
        Parameters:
        sd - The SameDiff instance
        at - Current iteration/epoch etc
        dataSet - The current dataset (minibatch) used for training
        loss - 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)