scikit-learn: add which solver was used in sklearn Ridge regression : add clf.get_params(solver)
Describe the issue linked to the documentation
https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html
solver{‘auto’, ‘svd’, ‘cholesky’, ‘lsqr’, ‘sparse_cg’, ‘sag’, ‘saga’, ‘lbfgs’}, default=’auto’ Solver to use in the computational routines:
‘auto’ chooses the solver automatically based on the type of data.
Suggest a potential alternative/fix
add how to find which solver actually was used
for example
>>> from sklearn.linear_model import Ridge
>>> import numpy as np
>>> n_samples, n_features = 10, 5
>>> rng = np.random.RandomState(0)
>>> y = rng.randn(n_samples)
>>> X = rng.randn(n_samples, n_features)
>>> clf = Ridge(alpha=1.0)
>>> clf.fit(X, y)
Ridge()
add
clf.get_params(solver)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
If we want to expose the selected solver, I see are two options:
chosen_solver_
that makes it clear what the chosen solver was.https://github.com/scikit-learn/scikit-learn/blob/0dfaaadfe2d0e0b4fd9d2ba22a75b7b1b1903049/sklearn/linear_model/_ridge.py#L493-L502
To help motivate the new feature, what is your use case for knowing the chosen solver?