Exemplo n.º 1
0
def test_split_data_shuffle_false_first_val_fold():
    X, y = data_gen()
    indices = split_data(X, shuffle=False)
    ind_val, ind_train = next(indices)
    assert np.array_equal(
        ind_val, np.arange(34)
    ), "`shuffle=False` doesn't work in split_data for the first validation fold"
Exemplo n.º 2
0
def test_split_data_stopiteration_error():
    X, y = data_gen()
    indices = split_data(X, shuffle=False)
    next(indices)
    next(indices)
    next(indices)
    with pytest.raises(StopIteration):
        next(indices)
Exemplo n.º 3
0
def test_split_data_shuffle_false_last_val_fold():
    X, y = data_gen()
    indices = split_data(X, shuffle=False)
    next(indices)
    next(indices)
    ind_val, ind_train = next(indices)
    assert np.array_equal(ind_val,
                          np.arange(67, 100)), "`shuffle=False` doesn't work in split_data for the validation fold"
Exemplo n.º 4
0
def test_split_data_stopiteration_error():
    X, y = data_gen()
    indices = split_data(X, shuffle=False)
    next(indices)
    next(indices)
    next(indices)
    with pytest.raises(StopIteration):
        next(indices)
Exemplo n.º 5
0
def test_split_data_shuffle_true():
    X, y = data_gen()
    indices = split_data(X, shuffle=True)
    ind_val, ind_train = next(indices)
    assert not np.array_equal(ind_val, np.arange(34)), "`shuffle=True` doesn't work in split_data"
Exemplo n.º 6
0
def test_split_data_output_is_generator():
    X, y = data_gen()
    indices = split_data(X, shuffle=False)
    assert isinstance(indices, types.GeneratorType), "split_data output should be a generator"
Exemplo n.º 7
0
def test_split_data_shuffle_true():
    X, y = data_gen()
    indices = split_data(X, shuffle=True)
    ind_val, ind_train = next(indices)
    assert not np.array_equal(
        ind_val, np.arange(34)), "`shuffle=True` doesn't work in split_data"
Exemplo n.º 8
0
def test_split_data_output_is_generator():
    X, y = data_gen()
    indices = split_data(X, shuffle=False)
    assert isinstance(
        indices,
        types.GeneratorType), "split_data output should be a generator"