A Pipeline is built as Pipeline([('scale', StandardScaler()), ('model', LogisticRegression())]). How is C changed through set_params?
Correct answer
C. pipeline.set_params(model__C=0.1), using the step name and a double underscore
15 views
C. pipeline.set_params(model__C=0.1), using the step name and a double underscore
15 views
set_params addresses nested estimator parameters with the step name, two underscores and the parameter, so model__C reaches LogisticRegression's C. A single underscore or dotted notation raises because the pipeline looks for a top-level parameter of that name. get_params follows the same convention and is what makes cloning and pipeline grid searches work.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is C? Ask here and get an explanation.