def test_callbacks(self): earlystop_auc = callbacks.EarlyStopping(self.KLte, self.Yte, patience=5, cooldown=1, metric='auc') earlystop_acc = callbacks.EarlyStopping(self.KLte, self.Yte, patience=3, cooldown=2, metric='accuracy') cbks = [earlystop_auc, earlystop_acc] clf = algorithms.GRAM(max_iter=100, learning_rate=.01, callbacks=cbks) clf = clf.fit(self.KLtr, self.Ytr)
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.RMKL(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)