def test_make_early_stopping_hook_valueerror(self): with self.assertRaises(ValueError): early_stopping.make_early_stopping_hook( self._estimator, should_stop_fn=lambda: True, run_every_secs=60, run_every_steps=100)
def test_make_early_stopping_hook_typeerror(self): with self.assertRaises(TypeError): early_stopping.make_early_stopping_hook( estimator=object(), should_stop_fn=lambda: True)
def test_make_early_stopping_hook(self, should_stop): self.run_session([ early_stopping.make_early_stopping_hook( self._estimator, should_stop_fn=lambda: should_stop) ], should_stop)