Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
satra committed Dec 8, 2020
1 parent 3f5a461 commit 68b2953
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ Each model contains:
trained_model = data[0][1].output.model
trained_model.predict(np.random.rand(1, 30))
```
Please check the value of `data[N][0]` to ensure that you are not using
a permuted model.
- One figure per metric with performance distribution across splits (with or
without null distribution trained on permuted labels)
- One figure per any metric with the word `score` in it reporting the results of
Expand Down
5 changes: 5 additions & 0 deletions pydra_ml/tests/test_classifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from ..classifier import gen_workflow, run_workflow
import numpy as np


def test_classifier(tmpdir):
Expand Down Expand Up @@ -32,6 +33,8 @@ def test_classifier(tmpdir):
assert results[0][0]["ml_wf.clf_info"][1] == "MLPClassifier"
assert results[0][0]["ml_wf.permute"]
assert results[0][1].output.score[0][0] < results[1][1].output.score[0][0]
assert hasattr(results[2][1].output.model, "predict")
assert isinstance(results[2][1].output.model.predict(np.ones((1, 30))), np.ndarray)


def test_regressor(tmpdir):
Expand Down Expand Up @@ -69,3 +72,5 @@ def test_regressor(tmpdir):
assert results[0][0]["ml_wf.clf_info"][-1][1] == "MLPRegressor"
assert results[0][0]["ml_wf.permute"]
assert results[0][1].output.score[0][0] < results[1][1].output.score[0][0]
assert hasattr(results[2][1].output.model, "predict")
assert isinstance(results[2][1].output.model.predict(np.ones((1, 10))), np.ndarray)

0 comments on commit 68b2953

Please sign in to comment.