python随机森林特征重要性_Python中随机森林回归的特征重要性
當涉及到決策樹時,特征重要性不是一個黑匣子。來自DecisionTreeRegressor的文檔:The importance of a feature is computed as the (normalized) total
reduction of the criterion brought by that feature. It is also known
as the Gini importance.
對于一個森林來說,它只是平均分布在你的森林中不同的樹上。查看source code:def feature_importances_(self):
"""Return the feature importances (the higher, the more important the
feature).
Returns
-
feature_importances_ : array, shape = [n_features]
"""
if self.estimators_ is None or len(self.estimators_) == 0:
raise NotFittedError("Estimator not fitted, "
"call `fit` before `feature_importances_`.")
all_importances = Parallel(n_jobs=self.n_jobs,
backend="threading")(
delayed(getattr)(tree, 'feature_importances_')
for tree in self.estimators_)
return sum(all_importances) / len(self.estimators_)
總結
以上是生活随笔為你收集整理的python随机森林特征重要性_Python中随机森林回归的特征重要性的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用c语言绘制自定义图形,Android使
- 下一篇: mysql or_MySQL中or语句用