0

在 gridsearchCV 中,当我适合如下内容时:

forest_reg = RandomForestRegressor()
grid_search = GridSearchCV(forest_reg, param_grid,cv=5,scoring = 'neg_mean_squared_error')
grid_search.fit(X_train,y_train)

之后,当我执行此操作时,

GridSearch.best_estimator_.feature_importances_ 

它给出了一个值数组,所以我的问题是GridSearch.best_estimator_.feature_importances_这条线返回什么值?

4

1 回答 1

1

在您的情况下,GridSearch.best_estimator_.feature_importances_返回一个RandomForestRegressor对象。

因此,根据RandomForestRegressor 文档

feature_importances_ : array of shape = [n_features] 返回特征重要性(越高,特征越重要)。

换句话说,它会根据您的训练集返回最重要的特征X_train。的每个元素feature_importances_对应于 的一个特征X_train(例如: 的第一个元素feature_importances_指的是 的第一个特征/列X_train)。

中的元素的值越高,中feature_importances_的特征就越重要X_train

于 2019-03-18T13:43:44.177 回答