add which solver was used in sklearn Ridge regression : add clf.get_params(solver)
See original GitHub issueDescribe 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)
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
sklearn.linear_model.Ridge — scikit-learn 1.2.0 documentation
This model solves a regression model where the loss function is the linear least squares function and regularization is given by the l2-norm....
Read more >sklearn.linear_model.LogisticRegression
This class implements regularized logistic regression using the 'liblinear' library, 'newton-cg', 'sag', 'saga' and 'lbfgs' solvers. Note that regularization is ...
Read more >sklearn.linear_model.LogisticRegressionCV
This class implements logistic regression using liblinear, newton-cg, sag of lbfgs optimizer. The newton-cg, sag and lbfgs solvers support only L2 ...
Read more >sklearn.linear_model.LinearRegression
Ridge. Ridge regression addresses some of the problems of Ordinary Least Squares by imposing a penalty on the size of the coefficients with...
Read more >sklearn.linear_model.ridge_regression
'auto' chooses the solver automatically based on the type of data. · 'svd' uses a Singular Value Decomposition of X to compute the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?
@tofetpuzo I’m not sure if there is a good way to take this offline, but perhaps we can discuss in more detail in my PR? Alternatively, if you would like to link your own PR, I would be happy to work with you there instead.