Skip to content

Commit

Permalink
Finish initial model selection testing
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherjenness committed Aug 10, 2017
1 parent fad1024 commit b0265c0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_modelselection.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,28 @@ def test_error_cross_entropy_error():
predictions = np.array([0.0, 0.0, 1.0, 1.0, 1.0, 1.0])
error = modelselection.Error.cross_entropy_error(y, predictions)
assert np.isclose(error, 6.912757780650054)


def test_k_fold_generator():
np.random.seed(10)
splitter = modelselection.k_fold_generator(20)
split = splitter.next()
assert len(split[0]) == 18
assert len(split[1]) == 2


def test_k_fold_generator_odd():
np.random.seed(10)
splitter = modelselection.k_fold_generator(21)
split = splitter.next()
assert len(split[0]) == 19
assert len(split[1]) == 2


def test_test_train_splitter():
X, y = data.categorical_2Dmatrix_data_big()
X_train, X_test, y_train, y_test = modelselection.test_train_splitter(X, y)
assert X_train.shape == (9, 2)
assert X_test.shape == (2, 2)
assert len(y_train) == 9
assert len(y_test) == 2

0 comments on commit b0265c0

Please sign in to comment.