我用管道做了一个GridsearchCV
,我想提取管道组件(mlprepressor)的一个属性(n_iter_
),以获得最佳模型。你知道吗
我正在使用python3.0。你知道吗
创建管道
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)
当我想用gridCV_GBR.best_params_
提取最佳模型时,我只有GridsearchCV的结果:
{'MLPR__alpha': 0.001, 'MLPR__hidden_layer_sizes': (50,)}
但是我想知道gridCV_MLPR
的最佳模型所使用的mlprepressor的迭代次数。你知道吗
如何通过GridsearhCV的管道使用为MLPRegressor()
设计的n_iter_
属性?你知道吗
谢谢你的帮助
我找到了解决办法:
由于
gridCV_MLPR.best_estimator_
是一个管道,我们需要用.named_steps['MLPR']
选择mlprepressor参数。你知道吗非常感谢你非常,非常迅速的回答。。。你知道吗
相关问题 更多 >
编程相关推荐