Ask Your Question
4

The keyword argument 'normalize' was not expected in the __init__() method of Ridge.

asked 2022-01-16 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-12 13:00:00 +0000

nofretete gravatar image

This error occurs when you pass the argument 'normalize' to the Ridge class constructor (init method), which is not a valid argument for the Ridge class.

The Ridge class has several valid arguments, such as alpha, fit_intercept, solver, etc. but 'normalize' is not one of them.

To resolve this error, simply remove the 'normalize' argument from the Ridge class constructor call. Alternatively, you can use a different class that supports the 'normalize' argument, such as RidgeCV or LassoCV.

Example of incorrect usage:

from sklearn.linear_model import Ridge

model = Ridge(normalize=True)

Example of correct usage:

from sklearn.linear_model import Ridge

model = Ridge(alpha=0.5, fit_intercept=True)

Alternatively, using RidgeCV:

from sklearn.linear_model import RidgeCV

model = RidgeCV(normalize=True)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-16 11:00:00 +0000

Seen: 31 times

Last updated: Apr 12 '21