@Test public void when_callingOnNewEpochWithHistoryProcessor_expect_stopMonitorNotCalled() { TestTrainer trainer = new TestTrainer(); IHistoryProcessor.Configuration hpConf = new IHistoryProcessor.Configuration(5, 4, 4, 4, 4, 0, 0, 2); MockHistoryProcessor hp = new MockHistoryProcessor(hpConf); trainer.setHistoryProcessor(hp); DataManagerTrainingListener sut = new DataManagerTrainingListener(new MockDataManager(false)); TrainingListener.ListenerResponse response = sut.onEpochTrainingResult(trainer, null); assertEquals(1, hp.stopMonitorCallCount); assertEquals(TrainingListener.ListenerResponse.CONTINUE, response); }
@Override public ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry) { IHistoryProcessor hp = trainer.getHistoryProcessor(); if(hp != null) { hp.stopMonitor(); } try { dataManager.appendStat(statEntry); } catch (Exception e) { log.error("Training failed.", e); return ListenerResponse.STOP; } return ListenerResponse.CONTINUE; }
DataManagerTrainingListener implements TrainingListener { @Override public ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry) { IHistoryProcessor hp = trainer.getHistoryProcessor(); if(hp != null) { hp.stopMonitor(); } try { dataManager.appendStat(statEntry); } catch (Exception e) { log.error("Training failed.", e); return ListenerResponse.STOP; } return ListenerResponse.CONTINUE; } }
DataManagerTrainingListener implements TrainingListener { @Override public ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry) { IHistoryProcessor hp = trainer.getHistoryProcessor(); if(hp != null) { hp.stopMonitor(); } try { dataManager.appendStat(statEntry); } catch (Exception e) { log.error("Training failed.", e); return ListenerResponse.STOP; } return ListenerResponse.CONTINUE; } DataManagerTrainingListener(IDataManager dataManager); }
DataManagerTrainingListener implements TrainingListener { @Override public ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry) { IHistoryProcessor hp = trainer.getHistoryProcessor(); if(hp != null) { hp.stopMonitor(); } try { dataManager.appendStat(statEntry); } catch (Exception e) { log.error("Training failed.", e); return ListenerResponse.STOP; } return ListenerResponse.CONTINUE; } DataManagerTrainingListener(IDataManager dataManager); @Override ListenerResponse onTrainingStart(); @Override void onTrainingEnd(); @Override ListenerResponse onNewEpoch(IEpochTrainer trainer); @Override ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry); @Override ListenerResponse onTrainingProgress(ILearning learning); }
DataManagerTrainingListener implements TrainingListener { @Override public ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry) { IHistoryProcessor hp = trainer.getHistoryProcessor(); if(hp != null) { hp.stopMonitor(); } try { dataManager.appendStat(statEntry); } catch (Exception e) { log.error("Training failed.", e); return ListenerResponse.STOP; } return ListenerResponse.CONTINUE; } DataManagerTrainingListener(IDataManager dataManager); @Override ListenerResponse onTrainingStart(); @Override void onTrainingEnd(); @Override ListenerResponse onNewEpoch(IEpochTrainer trainer); @Override ListenerResponse onEpochTrainingResult(IEpochTrainer trainer, IDataManager.StatEntry statEntry); @Override ListenerResponse onTrainingProgress(ILearning learning);  }