From fdf378f5c8116c9a7ff7b03c7c32b7e1e0231ca8 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Schmidt Date: Tue, 15 Jun 2021 17:31:01 -0400 Subject: [PATCH] fix issue #381 (#382) * fixed method and added test * added changelog entry * Prepared changelog for release --- CHANGELOG.rst | 14 +++++++++++++- src/quantcore/glm/_solvers.py | 2 +- tests/glm/test_glm.py | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9adbe964..c32ea3a6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,13 +8,25 @@ Changelog ========= Unreleased +---------- + + +1.4.2 - 2021-06-15 ------------------ -**Tutorials and documenation improvements**: + +**Tutorials and documenation improvements:** + - Adding tutorials to the documentation - Additional documentation improvements +**Bug fix:** + +- Verbose progress bar now working again. + **Other:** + - Small improvement in documentation for the ``alpha_index`` argument to :func:`quantcore.glm.GeneralizedLinearRegressor.predict`. +- Pinned pre-commit hooks versions. 1.4.1 - 2021-05-01 ------------------ diff --git a/src/quantcore/glm/_solvers.py b/src/quantcore/glm/_solvers.py index fc59dd42..49edf54c 100644 --- a/src/quantcore/glm/_solvers.py +++ b/src/quantcore/glm/_solvers.py @@ -407,7 +407,7 @@ def _update(self, n_iter, iteration_runtime, cur_grad_norm): step = max(self.n_bar_steps - (np.log10(cur_grad_norm) - np.log10(self.tol)), 0) # round to two digits for beauty self.t.n = np.round(step, 2) - self.t._update(0) + self.t.update(0) class IRLSData: diff --git a/tests/glm/test_glm.py b/tests/glm/test_glm.py index 82118b50..cf237007 100644 --- a/tests/glm/test_glm.py +++ b/tests/glm/test_glm.py @@ -1810,3 +1810,11 @@ def test_alpha_parametrization_fail(kwargs, regression_data): with pytest.raises((ValueError, TypeError)): model = GeneralizedLinearRegressor(**kwargs) model.fit(X=X, y=y) + + +def test_verbose(regression_data, capsys): + X, y = regression_data + mdl = GeneralizedLinearRegressor(verbose=1) + mdl.fit(X=X, y=y) + captured = capsys.readouterr() + assert "Iteration" in captured.err