Exemple #1
0
 def test_scheduler(self):
     scheduler = ReduceOnWorsening()
     clf = algorithms.MEMO(max_iter=20, learning_rate=.1, scheduler=scheduler)\
      .fit(self.KLtr, self.Ytr)
     scheduler = ReduceOnWorsening(multiplier=.6, min_lr=1e-4)
     clf = algorithms.MEMO(max_iter=20, learning_rate=.1, scheduler=scheduler)\
      .fit(self.KLtr, self.Ytr)
Exemple #2
0
 def test_callbacks(self):
     earlystop_auc = callbacks.EarlyStopping(self.KLte,
                                             self.Yte,
                                             patience=30,
                                             cooldown=2,
                                             metric='roc_auc')
     earlystop_acc = callbacks.EarlyStopping(self.KLte,
                                             self.Yte,
                                             patience=30,
                                             cooldown=2,
                                             metric='accuracy')
     monitor = callbacks.Monitor(
         metrics=[metrics.radius, metrics.margin, metrics.frobenius])
     cbks = [earlystop_auc, earlystop_acc, monitor]
     clf = algorithms.MEMO(max_iter=60, learning_rate=.1, callbacks=cbks)
     clf = clf.fit(self.KLtr, self.Ytr)
     self.assertEqual(len(monitor.history), 3)
     print(monitor.objective)
     self.assertEqual(len(monitor.objective), 60)
Exemple #3
0
 def test_theta(self):
     clf = algorithms.MEMO(theta=10, max_iter=30).fit(self.KLtr, self.Ytr)
     clf = algorithms.MEMO(theta=0.0001,
                           max_iter=30).fit(self.KLtr, self.Ytr)
Exemple #4
0
 def test_MEMO(self):
     self.base_evaluation(algorithms.MEMO(max_iter=10))
     self.base_evaluation(algorithms.MEMO(max_iter=10, learner=SVC(C=10)))
     self.base_evaluation(
         algorithms.MEMO(max_iter=10, learner=algorithms.KOMD(lam=1)))