I made a GridsearchCV
with a pipeline and I want to extract one attribute (n_iter_
) of a component of the pipeline (MLPRegressor) for the best model.
I'm using Python 3.0.
Creation of the pipeline
pipeline_steps = [('scaler', StandardScaler()), ('MLPR', MLPRegressor(solver='lbfgs', early_stopping=True, validation_fraction=0.1, max_iter=10000))]
MLPR_parameters = {'MLPR__hidden_layer_sizes':[(50,), (100,), (50,50)], 'MLPR__alpha':[0.001, 10, 1000]}
MLPR_pipeline = Pipeline(pipeline_steps)
gridCV_MLPR = GridSearchCV(MLPR_pipeline, MLPR_parameters, cv=kfold)
gridCV_MLPR.fit(X_train, y_train)
When I want to extract the best model with gridCV_GBR.best_params_
, I only have the result for the GridsearchCV :
{'MLPR__alpha': 0.001, 'MLPR__hidden_layer_sizes': (50,)}
But I want to have the number of iteration of MLPRegressor used by the best model of gridCV_MLPR
.
How is it possible to use the n_iter_
attribute designed for MLPRegressor()
through the pipeline with GridsearhCV ?