带有管道和 GridSearchCV 的 StandardScaler

我已经把standardScaler 放在管道上,CV_mlpregressor.predict(x_test) 的结果很奇怪。我想我必须从standardScaler 带回这些值,但仍然无法弄清楚如何。


pipe_MLPRegressor = Pipeline([('scaler',  StandardScaler()),

            ('MLPRegressor', MLPRegressor(random_state = 42))])



grid_params_MLPRegressor = [{

    'MLPRegressor__solver': ['lbfgs'],

    'MLPRegressor__max_iter': [100,200,300,500],

    'MLPRegressor__activation' : ['relu','logistic','tanh'],

    'MLPRegressor__hidden_layer_sizes':[(2,), (4,),(2,2),(4,4),(4,2),(10,10),(2,2,2)],

}]



CV_mlpregressor = GridSearchCV (estimator = pipe_MLPRegressor,

                               param_grid = grid_params_MLPRegressor,

                               cv = 5,return_train_score=True, verbose=0)


CV_mlpregressor.fit(x_train, y_train)


CV_mlpregressor.predict(x_test)

结果:


array([ 2.67564153e+04,  1.90010572e+04,  9.62702942e+04,  3.98791931e+04,

        1.48889808e+03,  7.08980726e+03,  3.86311279e+02,  7.05602301e+04,

        4.06858486e+03,  4.29186303e+04,  3.86701735e+03,  6.30228075e+04,

        6.78276925e+04, -5.91956287e+02, -7.37680434e+02,  3.07485001e+04,

        4.81417953e+03,  5.18697686e+03,  1.61221952e+04,  1.33794944e+04,

       -1.48375101e+03,  1.80891807e+04,  1.39740243e+04,  6.57156849e+04,

        3.32962481e+04,  5.71332087e+05,  1.79130092e+03,  5.25642370e+04,

        2.08111172e+04,  4.31060127e+04])

提前致谢。


繁星coding
浏览 210回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python