首页 > 解决方案 > 随机森林特征重要性显示列表中间全零的变量

问题描述

我使用以下代码对一些具有 10000 行和大约 700 个变量的数据运行了随机森林回归器

X_train, X_test, y_train, y_test = train_test_split(features, labels, test_size = 0.25, random_state = 42)
model = RandomForestRegressor(n_estimators = 1000, max_depth=20)
model.fit(X_train, y_train[:,0])

我的一个变量包含全零,但是当我查看有序列表时它显示了大约一半

model.feature_importances_

随机森林如何使用包含每个数据点为零的列而不是其他非静态列?

标签: scikit-learnrandom-forest

解决方案


推荐阅读