Hello,
Answer (c) also works
No it does not behave what we expect:
model.get_params("C")
{'C': 1.0,
'class_weight': None,
'dual': False,
'fit_intercept': True,
'intercept_scaling': 1,
'l1_ratio': None,
'max_iter': 100,
'multi_class': 'auto',
'n_jobs': None,
'penalty': 'l2',
'random_state': None,
'solver': 'lbfgs',
'tol': 0.0001,
'verbose': 0,
'warm_start': False}
You can observe that it returns the full list of all the parameter while you are requesting only "C"
. So why does it looks like it does something sensible. get_params
take a keyword parameter deep
.
model.get_params("C")
is then equivalent to model.get_params(deep="C")
. Since scikit-learn expect deep
to be a boolean, there is great chance that the passed parameter will be cast by Python into a boolean if it is not one. bool("C")
will be cast to True
. So model.get_params("C")
is the equivalent of model.get_params()
and explains why we get the list of all parameters of the model.