glm-tools / pyglmnet

Python implementation of elastic-net regularized generalized linear models
http://glm-tools.github.io/pyglmnet/
MIT License
280 stars 84 forks source link

Parameterized tests #282

Closed tommyod closed 5 years ago

tommyod commented 5 years ago

The output from testing is:

============================= test session starts ==============================
platform linux -- Python 3.7.2, pytest-4.3.1, py-1.8.0, pluggy-0.9.0 -- /home/tommy/anaconda3/envs/pyglmnet/bin/python
cachedir: .pytest_cache
rootdir: /home/tommy/Desktop/pyglmnet, inifile:
plugins: cov-2.6.1
collected 32 items                                                             

tests/test_metrics.py::test_deviance PASSED                              [  3%]
tests/test_metrics.py::test_pseudoR2 PASSED                              [  6%]
tests/test_metrics.py::test_accuracy PASSED                              [  9%]
tests/test_pyglmnet.py::test_gradients[gaussian] PASSED                  [ 12%]
tests/test_pyglmnet.py::test_gradients[binomial] PASSED                  [ 15%]
tests/test_pyglmnet.py::test_gradients[softplus] PASSED                  [ 18%]
tests/test_pyglmnet.py::test_gradients[poisson] PASSED                   [ 21%]
tests/test_pyglmnet.py::test_gradients[probit] PASSED                    [ 25%]
tests/test_pyglmnet.py::test_gradients[gamma] PASSED                     [ 28%]
tests/test_pyglmnet.py::test_tikhonov PASSED                             [ 31%]
tests/test_pyglmnet.py::test_group_lasso PASSED                          [ 34%]
tests/test_pyglmnet.py::test_glmnet[gaussian] PASSED                     [ 37%]
tests/test_pyglmnet.py::test_glmnet[binomial] PASSED                     [ 40%]
tests/test_pyglmnet.py::test_glmnet[softplus] PASSED                     [ 43%]
tests/test_pyglmnet.py::test_glmnet[poisson] PASSED                      [ 46%]
tests/test_pyglmnet.py::test_glmnet[probit] PASSED                       [ 50%]
tests/test_pyglmnet.py::test_glmnet[gamma] PASSED                        [ 53%]
tests/test_pyglmnet.py::test_glmcv[gaussian] PASSED                      [ 56%]
tests/test_pyglmnet.py::test_glmcv[binomial] PASSED                      [ 59%]
tests/test_pyglmnet.py::test_glmcv[softplus] PASSED                      [ 62%]
tests/test_pyglmnet.py::test_glmcv[poisson] PASSED                       [ 65%]
tests/test_pyglmnet.py::test_glmcv[probit] PASSED                        [ 68%]
tests/test_pyglmnet.py::test_glmcv[gamma] PASSED                         [ 71%]
tests/test_pyglmnet.py::test_cv PASSED                                   [ 75%]
tests/test_pyglmnet.py::test_cdfast[gaussian] PASSED                     [ 78%]
tests/test_pyglmnet.py::test_cdfast[binomial] PASSED                     [ 81%]
tests/test_pyglmnet.py::test_cdfast[softplus] PASSED                     [ 84%]
tests/test_pyglmnet.py::test_cdfast[poisson] PASSED                      [ 87%]
tests/test_pyglmnet.py::test_cdfast[probit] PASSED                       [ 90%]
tests/test_pyglmnet.py::test_cdfast[gamma] PASSED                        [ 93%]
tests/test_pyglmnet.py::test_fetch_datasets PASSED                       [ 96%]
tests/test_pyglmnet.py::test_random_state_consistency PASSED             [100%]

=============================== warnings summary ===============================
tests/test_pyglmnet.py::test_fetch_datasets
  /home/tommy/anaconda3/envs/pyglmnet/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
    return f(*args, **kwds)

-- Docs: https://docs.pytest.org/en/latest/warnings.html

----------- coverage: platform linux, python 3.7.2-final-0 -----------
Name                   Stmts   Miss Branch BrPart  Cover
--------------------------------------------------------
pyglmnet/__init__.py       4      0      0      0   100%
pyglmnet/base.py          66     28     34      8    56%
pyglmnet/metrics.py       21      0      6      0   100%
pyglmnet/pyglmnet.py     487     73    200     26    79%
pyglmnet/utils.py         43     25     10      4    42%
--------------------------------------------------------
TOTAL                    621    126    250     38    75%

========================== slowest 10 test durations ===========================
14.56s call     tests/test_pyglmnet.py::test_random_state_consistency
10.41s call     tests/test_pyglmnet.py::test_glmcv[probit]
9.20s call     tests/test_pyglmnet.py::test_cv
3.34s call     tests/test_pyglmnet.py::test_glmcv[poisson]
2.48s call     tests/test_pyglmnet.py::test_fetch_datasets
2.40s call     tests/test_pyglmnet.py::test_glmcv[softplus]
2.29s call     tests/test_pyglmnet.py::test_glmcv[gaussian]
2.26s call     tests/test_pyglmnet.py::test_glmcv[gamma]
2.26s call     tests/test_pyglmnet.py::test_glmcv[binomial]
0.32s call     tests/test_metrics.py::test_deviance
==================== 32 passed, 1 warnings in 52.02 seconds ====================
codecov-io commented 5 years ago

Codecov Report

Merging #282 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #282   +/-   ##
=======================================
  Coverage   73.74%   73.74%           
=======================================
  Files           4        4           
  Lines         617      617           
  Branches      124      124           
=======================================
  Hits          455      455           
  Misses        123      123           
  Partials       39       39

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2bd1d22...4044c91. Read the comment docs.

jasmainak commented 5 years ago

Neat, nice contribution. Thanks @tommyod !