Issue
In scikit-learn, Lasso and Ridge regression are two regression methods which have a random_state
attribute. Why do these two methods need this attribute?
From the documentation:
class sklearn.linear_model.Lasso(alpha=1.0, fit_intercept=True, normalize=False, precompute=False, copy_X=True, max_iter=1000, tol=0.0001, warm_start=False, positive=False, random_state=None, selection=’cyclic’)
class sklearn.linear_model.Ridge(alpha=1.0, fit_intercept=True, normalize=False, copy_X=True, max_iter=None, tol=0.001, solver=’auto’, random_state=None)
Solution
In the case of lasso, RNG can be used (depending on other selected options) to randomly select features for which to perform updates:
The seed of the pseudo random number generator that selects a random feature to update. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Used when selection == ‘random’.
In the case of ridge, RNG can be used (depending on other selected options) for shuffling data:
The seed of the pseudo random number generator to use when shuffling the data. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Used when solver == ‘sag’.
Answered By - Dennis Soemers
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.