Pass a dict to scikit learn estimator

The best solution to initialise your estimator with the right parameters would be to unpack your dictionary:

lr = LinearRegression(**params)

If for some reason you need to set some parameters afterwards, you could use:

lr.set_params(**params)

This has an advantage over using setattr in that it allows Scikit learn to perform some validation checks on the parameters.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)