コード例 #1
0
def test_compare_sklearn_mod_0():
    X, y = data_gen(nrows = 99)
    function_scores = cross_validation(lm(), X = X, y = y, shuffle = False)
    sklearn_scores = cross_val_score(lm(), X = X, y = y, cv = 3)
    assert max(function_scores - sklearn_scores) < 0.000001, "results doesn't match sklearn"
コード例 #2
0
def test_y_one_column():
    X, y = data_gen()
    y = X
    with pytest.raises(TypeError):
        cross_validation(lm(), X=X, y=y)
コード例 #3
0
def test_X_y_Nrows():
    X, y = data_gen(nrows = 2)
    with pytest.raises(TypeError):
        cross_validation(lm(), X=X, y=y)
コード例 #4
0
def test_k_range():
    X, y = data_gen(nrows = 5)
    with pytest.raises(TypeError):
        cross_validation(lm(), X=X, y=y, k = 1)
    with pytest.raises(TypeError):
        cross_validation(lm(), X=X, y=y, k = 40)
コード例 #5
0
def test_X_y_match():
    X, y = data_gen()
    y = y[0:90]
    with pytest.raises(TypeError):
        cross_validation(lm(), X=X, y=y)
コード例 #6
0
def test_random_state_as_number():
    X, y = data_gen()
    with pytest.raises(TypeError):
        cross_validation(lm(), X = X, y = y, random_state = '10')
コード例 #7
0
def test_shuffle_as_boolean():
    X, y = data_gen()
    with pytest.raises(TypeError):
        cross_validation(lm(), X = X, y = y, shuffle = '1')
    with pytest.raises(TypeError):
        cross_validation(lm(), X=X, y=y, shuffle=1.0)
コード例 #8
0
def test_k_as_number():
    X, y = data_gen()
    with pytest.raises(TypeError):
        cross_validation(lm(), X = X, y = y, k = '3')
コード例 #9
0
def test_y_as_dataframe():
    X, y = data_gen()
    with pytest.raises(TypeError):
        train_test_split(lm(), X = X, y = "y")
コード例 #10
0
def test_X_as_dataframe():
    X, y = data_gen()
    with pytest.raises(TypeError):
        cross_validation(lm(), X = "X", y = y)