Exemplo n.º 1
0
def test_weasel_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)

    # train WEASEL
    weasel = WEASEL(random_state=1, binning_strategy="equi-depth")
    weasel.fit(X_train, y_train)

    score = weasel.score(X_test, y_test)
    # print(score)
    assert score >= 0.99
Exemplo n.º 2
0
def test_weasel_on_power_demand():
    # load power demand data
    X_train, y_train = load_italy_power_demand(split="train", return_X_y=True)
    X_test, y_test = load_italy_power_demand(split="test", return_X_y=True)

    # train WEASEL
    weasel = WEASEL(random_state=1, binning_strategy="kmeans")
    weasel.fit(X_train, y_train)

    score = weasel.score(X_test, y_test)
    # print(score)
    assert score >= 0.94
Exemplo n.º 3
0
def test_weasel_on_power_demand():
    # load power demand data
    X_train, y_train = load_italy_power_demand(split='train', return_X_y=True)
    X_test, y_test = load_italy_power_demand(split='test', return_X_y=True)

    # train WEASEL
    weasel = WEASEL(random_state=47)
    weasel.fit(X_train, y_train)

    score = weasel.score(X_test, y_test)
    print(score)
    assert (score >= 0.94)
Exemplo n.º 4
0
def test_weasel_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 WEASEL
    weasel = WEASEL(random_state=1379)
    weasel.fit(X_train, y_train)

    score = weasel.score(X_test, y_test)
    # print(score)
    assert score >= 0.99
Exemplo n.º 5
0
def test_weasel_on_unit_test_data():
    """Test of WEASEL 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 WEASEL
    weasel = WEASEL(random_state=0, window_inc=4)
    weasel.fit(X_train, y_train)

    # assert probabilities are the same
    probas = weasel.predict_proba(X_test.iloc[indices])
    testing.assert_array_almost_equal(probas,
                                      weasel_unit_test_probas,
                                      decimal=2)