def _current_reward_metric(self): metric_values = online_tune.historical_metric_values( self._trainer.history, self._reward_metric, ) assert metric_values.shape[0] > 0, ( 'No values in history for metric {}.'.format(self._reward_metric)) return metric_values[-1]
def test_retrieves_historical_metric_values(self): history = trax_history.History() self._append_metrics(history, ("train", "accuracy"), [0.1, 0.73]) metric_values = online_tune.historical_metric_values( history, metric=("train", "accuracy")) np.testing.assert_array_equal(metric_values, [0.1, 0.73])