def test_cnn_sample_wrong_X():
    """Test either if an error is raised when X is different at fitting
    and sampling"""

    # Create the object
    cnn = CondensedNearestNeighbour(random_state=RND_SEED)
    cnn.fit(X, Y)
    assert_raises(RuntimeError, cnn.sample, np.random.random((100, 40)),
                  np.array([0] * 50 + [1] * 50))
Exemple #2
0
def test_cnn_sample_wrong_X():
    """Test either if an error is raised when X is different at fitting
    and sampling"""

    # Create the object
    cnn = CondensedNearestNeighbour(random_state=RND_SEED)
    cnn.fit(X, Y)
    assert_raises(RuntimeError, cnn.sample, np.random.random((100, 40)),
                  np.array([0] * 50 + [1] * 50))
def test_cnn_fit():
    """Test the fitting method"""

    # Create the object
    cnn = CondensedNearestNeighbour(random_state=RND_SEED)
    # Fit the data
    cnn.fit(X, Y)

    # Check if the data information have been computed
    assert_equal(cnn.min_c_, 0)
    assert_equal(cnn.maj_c_, 1)
    assert_equal(cnn.stats_c_[0], 500)
    assert_equal(cnn.stats_c_[1], 4500)
def test_cnn_fit():
    """Test the fitting method"""

    # Create the object
    cnn = CondensedNearestNeighbour(random_state=RND_SEED)
    # Fit the data
    cnn.fit(X, Y)

    # Check if the data information have been computed
    assert_equal(cnn.min_c_, 0)
    assert_equal(cnn.maj_c_, 1)
    assert_equal(cnn.stats_c_[0], 500)
    assert_equal(cnn.stats_c_[1], 4500)