def test_boss_on_gunpoint(): # load gunpoint data X_train, y_train = load_gunpoint(split='train', return_X_y=True) X_test, y_test = load_gunpoint(split='test', return_X_y=True) indices = np.random.RandomState(0).permutation(10) # train boss boss = BOSSEnsemble(random_state=0) boss.fit(X_train.iloc[indices], y_train[indices]) # assert probabilities are the same probas = boss.predict_proba(X_test.iloc[indices]) testing.assert_array_equal(probas, boss_gunpoint_probas)
def test_boss_on_unit_test_data(): """Test of BOSS on unit test data.""" # load unit test data X_train, y_train = load_unit_test(split="train", return_X_y=True) X_test, y_test = load_unit_test(split="test", return_X_y=True) indices = np.random.RandomState(0).choice(len(y_train), 10, replace=False) # train BOSS boss = BOSSEnsemble(max_ensemble_size=5, random_state=0, save_train_predictions=True) boss.fit(X_train, y_train) # assert probabilities are the same probas = boss.predict_proba(X_test.iloc[indices]) testing.assert_array_almost_equal(probas, boss_unit_test_probas, decimal=2) # test train estimate train_probas = boss._get_train_probs(X_train, y_train) train_preds = boss.classes_[np.argmax(train_probas, axis=1)] assert accuracy_score(y_train, train_preds) >= 0.75