Пример #1
0
 def test_fit_and_predict(self):
     MAX_STEPS = 100
     additional["max_steps"] = MAX_STEPS
     iters_cnt = 5
     max_iters = MaxItersConstraint({"max_iters": iters_cnt})
     metric_logger = MetricLogger({"metric_names": ["logloss"]})
     il = IterativeLearner(self.train_params, callbacks=[max_iters, metric_logger])
     il.train(self.data)
     metric_logs = il.get_metric_logs()
     for k in range(self.kfolds):
         self.assertEqual(
             len(metric_logs[il.learners[k].uid]["train"]["logloss"]), iters_cnt
         )
         self.assertNotEqual(
             len(metric_logs[il.learners[k].uid]["train"]["logloss"]), MAX_STEPS
         )
 def test_fit_and_predict(self):
     MAX_STEPS = 10
     additional["max_steps"] = MAX_STEPS
     metric_logger = MetricLogger({"metric_names": ["logloss", "auc"]})
     il = IterativeLearner(self.train_params, callbacks=[metric_logger])
     il.train(self.data)
     metric_logs = il.get_metric_logs()
     self.assertEqual(
         len(metric_logs[il.learners[0].uid]["train"]["logloss"]),
         len(metric_logs[il.learners[0].uid]["train"]["auc"]),
     )
     self.assertEqual(
         len(metric_logs[il.learners[0].uid]["train"]["logloss"]),
         len(metric_logs[il.learners[0].uid]["iters"]),
     )
     self.assertEqual(
         len(metric_logs[il.learners[0].uid]["train"]["logloss"]),
         MAX_STEPS)