glm-tools / pyglmnet

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

have GLM objects record the number of iterations and convergence status #277

Closed ghost closed 4 years ago

ghost commented 5 years ago

This records the number of iterations within the GLM object, and whether or not the fit() iterations stopped because it converged or because it hit max_iter. It also logs a warning if max_iter is reached before convergence.

In the current pyglmnet master branch, the only indication of convergence is in the logs, so this change makes it easier to check convergence programmatically.

It passesnosetests . --with-coverage locally, and git diff main/master -U0 | flake8 --diff - flags no pep8 violations.

jasmainak commented 5 years ago

There is a bug with the convergence at the moment. See #275

This would be too verbose in my opinion. We should instead fix #275 first. Any help there is welcome

codecov-io commented 5 years ago

Codecov Report

Merging #277 into master will increase coverage by 0.68%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
+ Coverage   74.15%   74.84%   +0.68%     
==========================================
  Files           4        4              
  Lines         623      640      +17     
  Branches      127      127              
==========================================
+ Hits          462      479      +17     
  Misses        125      125              
  Partials       36       36
Impacted Files Coverage Δ
pyglmnet/pyglmnet.py 80.93% <100%> (+0.65%) :arrow_up:

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 8b15c58...d936152. Read the comment docs.

ghost commented 5 years ago

@jasmainak this is probably ready for another look.

I rebased to the current master and made sure it only logs each iteration's convergence when the logger is set to DEBUG - it's now silent at the default INFO level. It may also address #287.