Beispiel #1
0
 def test_evaluate(self):
     for est in self._estimators_for_tests():
         est.fake_checkpoint()
         noop_hook = _NoopHook()
         ex = Experiment(est,
                         train_input_fn='train_input',
                         eval_input_fn='eval_input',
                         eval_hooks=[noop_hook],
                         eval_steps='steps',
                         eval_delay_secs=0)
         ex.evaluate()
         self.assertEqual(0, est.fit_count)
         self.assertEqual(1, est.eval_count)
         self.assertEqual([noop_hook], est.eval_hooks)
    def test_evaluate_delay(self):
        for est in self._estimators_for_tests():
            est.fake_checkpoint()
            noop_hook = _NoopHook()
            ex = Experiment(
                est, train_input_fn='train_input', eval_input_fn='eval_input',
                eval_hooks=[noop_hook])

            for delay in [0, 1, 3]:
                sheep = SheepCounter()
                with test.mock.patch.object(time, 'time', sheep.time):
                    with test.mock.patch.object(time, 'sleep', sheep.sleep):
                        ex.evaluate(delay_secs=delay)
                self.assertAlmostEqual(delay, sheep.time(), delta=1e-4)
                self.assertEqual([noop_hook], est.eval_hooks)
 def test_evaluate(self):
     for est in self._estimators_for_tests():
         est.fake_checkpoint()
         noop_hook = _NoopHook()
         ex = Experiment(
             est,
             train_input_fn='train_input',
             eval_input_fn='eval_input',
             eval_hooks=[noop_hook],
             eval_steps='steps',
             eval_delay_secs=0)
         ex.evaluate()
         self.assertEqual(0, est.fit_count)
         self.assertEqual(1, est.eval_count)
         self.assertEqual([noop_hook], est.eval_hooks)
Beispiel #4
0
    def test_evaluate_delay(self):
        for est in self._estimators_for_tests():
            est.fake_checkpoint()
            noop_hook = _NoopHook()
            ex = Experiment(est,
                            train_input_fn='train_input',
                            eval_input_fn='eval_input',
                            eval_hooks=[noop_hook])

            for delay in [0, 1, 3]:
                sheep = SheepCounter()
                with test.mock.patch.object(time, 'time', sheep.time):
                    with test.mock.patch.object(time, 'sleep', sheep.sleep):
                        ex.evaluate(delay_secs=delay)
                self.assertAlmostEqual(delay, sheep.time(), delta=1e-4)
                self.assertEqual([noop_hook], est.eval_hooks)