在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_此行返回的值是什么??
发布于 2019-03-18 13:43:44
在您的示例中,GridSearch.best_estimator_.feature_importances_返回一个RandomForestRegressor对象。
因此,根据RandomForestRegressor 文档
feature_importances_:shape = n_features数组返回特性输入(越高,特性就越重要)。
换句话说,它根据您的培训集X_train返回最重要的特性。feature_importances_的每个元素对应于X_train的一个特性(例如:feature_importances_的第一个元素指的是X_train的第一个特性/列)。
feature_importances_中元素的值越高,X_train中的特性就越重要。
https://stackoverflow.com/questions/55221637
复制相似问题