Commit Graph

46 Commits

Author SHA1 Message Date
Christian Lorentzen dda6337b2c
ENH scaling of LogisticRegression loss as 1/n * LinearModelLoss (#26721)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2023-10-06 23:49:37 +02:00
Olivier Grisel 4e88150bc6
Fix AttributeError use_fallback_lbfgs_solve for newton-cholesky when fitting with max_iter=0 (#26653)
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
2023-06-26 15:07:59 +00:00
Adrin Jalali 42173fdb34
MNT add isort to ruff's rules (#26649) 2023-06-21 17:50:07 +02:00
Jérémie du Boisberranger 9c266cf5d6
MAINT Param validation: decorate all estimators with _fit_context (#26473) 2023-06-14 16:52:35 +02:00
Dimitri Papadopoulos Orfanos 2fd022d972
MAINT Fix typos found by codespell (#26448) 2023-05-31 10:19:21 +02:00
Adrin Jalali 893d5accaf
MNT Update black to 23.3.0 (#26110) 2023-04-06 12:14:16 -04:00
Jérémie du Boisberranger ea59b1e7b1
MNT Clean deprecations in glms for 1.3 (#25785) 2023-03-09 11:37:33 +01:00
Christian Veenhuis 610a0ce970
DOC unify usage of 'w.r.t.' (#25683) 2023-02-24 09:51:02 +01:00
Badr MOUFAD b728b2e8b1
DOC specify type of penalty in ``PoissonRegressor`` and ``TweedieRegressor`` docstring (#24971) 2022-11-20 18:57:47 +01:00
Badr MOUFAD 49aae1c67f
DOC improve `GammaRegressor` docstring (#24789) 2022-11-13 19:58:53 +01:00
Ashwin Mathur 0fafb8efeb
DOC Add Bernoulli, Categorical Distribution to Generalized Linear Models (GLM), add note to `Logistic Regression` on being a GLM (#24738)
* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

Co-authored-by: Arturo Amor <86408019+ArturoAmorQ@users.noreply.github.com>

* Rename  to

* Rename Generalized Linear Regression to Generalized Linear Models

* Added Deviance for Bernoulli and Binomial Distributions

* Added graphs of PMFs of Binomial and Bernoulli Distributions

* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

* Update doc/modules/linear_model.rst

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

* Update doc/modules/linear_model.rst

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

* Update doc/modules/linear_model.rst

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

* Add old reference identifier for Generalized_Linear_Regression

* Fix formatting of link to statsmodels package

* Removed mention of Binomial Distribution, Added information for Categorical Distribution

* Update doc/modules/linear_model.rst

Co-authored-by: Arturo Amor <86408019+ArturoAmorQ@users.noreply.github.com>

* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

Co-authored-by: Arturo Amor <86408019+ArturoAmorQ@users.noreply.github.com>

* Update doc/modules/linear_model.rst

Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>

* Update doc/modules/linear_model.rst

* Update doc/modules/linear_model.rst

Co-authored-by: Arturo Amor <86408019+ArturoAmorQ@users.noreply.github.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
2022-11-03 18:04:06 +01:00
Christian Lorentzen bb080aa690
ENH add newton-cholesky solver to LogisticRegression (#24767) 2022-11-03 14:37:11 +01:00
Christian Lorentzen ff9344f3d8
FEA add (single) Cholesky Newton solver to GLMs (#24637)
* FEA add NewtonSolver, CholeskyNewtonSolver and QRCholeskyNewtonSolver

* ENH better singular hessian special solve

* CLN fix some typos found by reviewer

* TST assert ConvergenceWarning is raised

* MNT add BaseCholeskyNewtonSolver

* WIP colinear design in GLMs

* FIX _solve_singular

* FIX false unpacking in

* TST add tests for unpenalized GLMs

* TST fix solutions of glm_dataset

* ENH add SVDFallbackSolver

* CLN remove SVDFallbackSolver

* ENH use gradient step for singular hessians

* ENH print iteration number in warnings

* TST improve test_linalg_warning_with_newton_solver

* CLN LinAlgWarning fron scipy.linalg

* ENH more robust hessian

* ENH increase maxls for lbfgs to make it more robust

* ENH add hessian_warning for too many negative hessian values

* CLN some warning messages

* ENH add lbfgs_step

* ENH use lbfgs_step for hessian_warning

* TST make them pass

* TST tweek rtol for lbfgs

* TST add rigoros test for GLMs

* TST improve test_warm_start

* ENH improve lbfgs options for better convergence

* CLN fix test_warm_start

* TST fix assert singular values in datasets

* CLN address most review comments

* ENH enable more vebosity levels for lbfgs

* DOC add whatsnew

* CLN remove xfail and clean a bit

* CLN docstring about minimum norm

* More informative repr for the glm_dataset fixture cases

* Forgot to run black

* CLN remove unnecessary filterwarnings

* CLN address review comments

* Trigger [all random seeds] on the following tests:
test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* CLN add comment for lbfgs ftol=64 * machine precision

* CLN XXX code comment

* Trigger [all random seeds] on the following tests:

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* CLN link issue and remove code snippet in comment

* Trigger [all random seeds] on the following tests:

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* CLN add catch_warnings

* Trigger [all random seeds] on the following tests:

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* Trigger [all random seeds] on the following tests:

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* [all random seeds]

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* Trigger with -Werror [all random seeds]

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* ENH increase maxls to 50

* [all random seeds]

test_glm_regression
test_glm_regression_hstacked_X
test_glm_regression_vstacked_X
test_glm_regression_unpenalized
test_glm_regression_unpenalized_hstacked_X
test_glm_regression_unpenalized_vstacked_X
test_warm_start

* Revert "Trigger with -Werror [all random seeds]"

This reverts commit 99f4cf99ca.

* TST add catch_warnings to filterwarnings

* TST adapt tests for newton solvers

* CLN cleaner gradient step with gradient_times_newton

* DOC add whatsnew

* ENH always use lbfgs as fallback

* TST adapt rtol

* TST fix test_linalg_warning_with_newton_solver

* CLN address some review comments

* Improve tests related to convergence warning on collinear data

* overfit -> fit

* Typo in comment

* Apply suggestions from code review

* ENH fallback_lbfgs_solve
- Do not use lbfgs steps, fall back complete to lbfgs

* ENH adapt rtol

* Improve test_linalg_warning_with_newton_solver

* Better comments

* Fixed Hessian casing and improved warning messages

* [all random seeds]

test_linalg_warning_with_newton_solver

* Ignore ConvergenceWarnings for now if convergence is good

* CLN remove counting of warnings

* ENH fall back to lbfgs if line search did not converge

* DOC better comment on performance bottleneck

* Update GLM related examples to use the new solver

* CLN address reviewer comments

* EXA improve some wordings

* CLN do not pop "solver in parameter constraints

* CLN fix typos

* DOC fix docstring

* CLN remove solver newton-qr-cholesky

* DOC update PR number in whatsnew

* CLN address review comments

* CLN remove unnecessary catch_warnings

* CLN address some review comments

* DOC more precise whatsnew

* CLN use init_zero_coef

* CLN use and test init_zero_coef

* CLN address some review comments

* CLN mark NewtonSolver as private by leading underscore

* CLN exact comments for inner_solve

* TST add test_newton_solver_verbosity

* TST extend test_newton_solver_verbosity

* TST logic in test_glm_regression_unpenalized

* TST use count_nonzero

* CLN remove super rare line search checks

* MNT move Newton solver to new file _newton_solver.py

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
2022-10-24 22:16:45 +02:00
Thomas J. Fan eb5f340e9f
MNT Do not update docs with deprecated decorator (#24410)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2022-10-14 15:14:31 +02:00
Jérémie du Boisberranger e41753ebd5
MAINT Clean deprecation for 1.2: normalize in linear models (#24391) 2022-10-12 14:06:47 +02:00
Thomas J. Fan 02ebf9e68f
MNT Adds dict typing hint to _parameter_constraints for mypy (#24301) 2022-08-30 11:01:10 +02:00
Jérémie du Boisberranger a8c6738bab
TST Fixes check_param_validation for failing tags (#23812) 2022-06-30 22:07:24 +02:00
Reshama Shaikh 3c75d36c65
MAINT validate parameters in GLM estimators (#23682)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
2022-06-30 15:24:45 +02:00
Christian Lorentzen 9d863aba2b
TST tight tests for GLMs (#23619)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2022-06-29 19:20:05 +02:00
Shuangchi He 2e3abc2e32
MAINT Fix some typos (#23251) 2022-04-30 15:03:40 -04:00
Thomas J. Fan b4053e258c
MNT Removes _linear_loss attribute in GLMs (#23126) 2022-04-14 21:35:23 +02:00
Christian Lorentzen 75a94f518f
ENH migrate GLMs / TweedieRegressor to linear loss (#22548)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-03-28 19:20:01 -04:00
Thomas J. Fan 4ff0767087
ENH Better error message for check_scalar (#22218)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2022-02-11 16:15:30 +01:00
Reshama Shaikh 561bad9f89
DOC added intervals for parameters for 4 GLM classes (#22076) 2022-01-24 17:12:13 +01:00
Reshama Shaikh b361f37e09
MAINT Use check_scalar to validate scalar in: GeneralizedLinearRegressor (#21946)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
2022-01-24 17:11:26 +01:00
Ross Barnowski 24106c2149
DOC Fix incorrect heading underline length in docstrings (#22278) 2022-01-24 09:58:33 -05:00
EricEllwanger b4f7f86d28
DOC - Ensure that TweedieRegressor pass numpydoc validation (#21104)
Co-authored-by: frellwan <frellwan@hotmail.com>
2021-09-23 11:38:07 +02:00
Dimitri Papadopoulos Orfanos f71c031314
DOC Typos found by codespell (#21069) 2021-09-17 19:04:54 +02:00
baam 289dab9a87
DOC Ensures that GammaRegressor passes numpydoc validation (#20973)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-09-08 17:33:56 +02:00
Thomas J. Fan 786c4e5e39
DOC Adds feature_names_in_ to docstrings (#20787) 2021-08-26 13:44:45 +02:00
Patric Lacouth 1fa9ce91e3
DOC Ensures that PoissonRegressor passes numpydoc validation (#20386)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-07-07 13:33:38 +02:00
Thomas J. Fan 3ae7c76153
STY Enables black with experimental_string_processing=true (#20412) 2021-06-29 09:47:04 +02:00
Thomas J. Fan 351ace7935
STY Uses black's with target_version >= 3.7 (#20294) 2021-06-17 15:50:27 -04:00
Thomas J. Fan 82df48934e
MNT Applies black formatting to most of the code base (#18948) 2021-06-17 14:21:09 -04:00
Guillaume Lemaitre 1cd282d600
DOC add n_features_in_ in the documentation (#20236) 2021-06-09 16:58:03 +02:00
Maria Telenczuk 9cfacf1540
DEP Deprecate 'normalize' in ridge models (#17772)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
2021-04-06 21:33:28 +02:00
Thomas J. Fan 95fa18f278
TST Fixes docstring ordering and test_docstring_parameters (#19048) 2021-02-12 11:35:05 +01:00
Zito Relova 96dfe1e1a1
DOC Add log-link to Gamma and Poisson Regressor (#19287) 2021-01-29 08:18:04 +01:00
Thomas J. Fan 5946f8bfed
ENH Adds n_features_in_ checks to linear and svm modules (#18578)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
2021-01-02 22:42:08 +01:00
Guillaume Lemaitre 255718b4ad
introduce _safe_tags for estimator not inheriting from BaseEstimator (#18797)
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2020-12-02 11:18:53 +01:00
Juan Carlos Alfaro Jiménez 5704442f80
MNT Change MRO for Generalized Linear Models (#18614) 2020-10-14 09:59:13 -04:00
Albert Villanova del Moral 7e545e1724
DOC Fix versionadded for 0.23 (#18522) 2020-10-05 10:23:32 +11:00
Atsushi Nukariya b898f25cc2
DOC Add examples to linear_model.TweedieRegressor (#17516)
* Add examples to linear_model.TweedieRegressor

* Address review
2020-06-07 10:09:53 -04:00
Atsushi Nukariya 76817211a1
DOC Add example to linear_model.GammaRegressor (#17519)
* Add examples to linear_model.GammaRegressor

* Apply suggestions from code review

Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>

Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2020-06-07 10:08:27 -04:00
Atsushi Nukariya 74b445efb7
DOC Add example to linear_model.PoissonRegressor (#17453)
* [WIP]: Add examples to linear_model.PoissonRegressor

* Address review

* Address review

* Apply suggestions from code review

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* Remove numpy import

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2020-06-06 23:43:29 -04:00
Roman Yurchak 69ea066412
ENH Minimal Generalized linear models implementation (L2 + lbfgs) (#14300)
Co-authored-by: Christian Lorentzen <lorentzen.ch@googlemail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
2020-03-04 14:08:24 +01:00