diff --git a/README.md b/README.md index cea465b..f09be30 100644 --- a/README.md +++ b/README.md @@ -73,28 +73,25 @@ python -m pytest tests/test_forward_selection.py $ py.test --cov=pypunisher tests/ -============================================================================ test session starts ============================================================================= platform darwin -- Python 3.6.3, pytest-3.4.1, py-1.5.2, pluggy-0.6.0 +... plugins: cov-2.5.1 -collected 12 items +collected 13 items -tests/test_backward_selection.py . [ 8%] -tests/test_criterion.py .... [ 41%] -tests/test_forward_selection.py . [ 50%] -tests/test_selection.py ...... [100%] +... ---------- coverage: platform darwin, python 3.6.3-final-0 ----------- Name Stmts Miss Cover --------------------------------------------------------------- -pypunisher/__init__.py 2 0 100% +pypunisher/__init__.py 4 0 100% pypunisher/_checks.py 19 1 95% pypunisher/metrics/__init__.py 1 0 100% pypunisher/metrics/criterion.py 28 3 89% pypunisher/selection_engines/__init__.py 2 0 100% -pypunisher/selection_engines/_utils.py 20 4 80% -pypunisher/selection_engines/selection.py 90 15 83% +pypunisher/selection_engines/_utils.py 20 2 90% +pypunisher/selection_engines/selection.py 90 11 88% --------------------------------------------------------------- -TOTAL 162 23 86% +TOTAL 164 17 90% ``` ## Contributors: diff --git a/tests/test_selection.py b/tests/test_selection.py index bd29258..45cf9c4 100644 --- a/tests/test_selection.py +++ b/tests/test_selection.py @@ -69,12 +69,18 @@ class Model(object): forward_output = forward() +# Run using the other parameter option +forward_output += forward(n_features=1, min_change=None) + # Force the backward selection algorithm to # select the single feature it thinks is most predictive. # If implemented correctly, `backward()` should be able to # identify `TRUE_BEST_FEATURE` as predictive. backward_output = backward(n_features=1) +# Run using the other parameter option +backward_output += backward(min_change=0.0001, n_features=None) + # ----------------------------------------------------------------------------- # Test outputs: Type @@ -97,6 +103,21 @@ def test_bsel_output_type(): output_type(backward_output) +# ----------------------------------------------------------------------------- +# Test `n_features` +# ----------------------------------------------------------------------------- + + +def test_n_features(): + """ + Test various version of n_features + """ + for n_features in (10000, -1.0): + with pytest.raises(ValueError): # should raise + backward(n_features=n_features) + backward(n_features=0.5) # this should not raise + + # ----------------------------------------------------------------------------- # Test outputs: Selection of the Predictive Feature # -----------------------------------------------------------------------------