You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于RandomForestClassifier的特征重要性识别与特征缩减技术问询

特征重要性计算与特征选择问题求助

最近在做特征工程时遇到了特征数量过多的问题,为了缩减特征规模,我打算用RandomForestClassifier来识别特征重要性,以此为依据完成特征选择。我写的实现代码如下:

from sklearn.ensemble import RandomForestClassifier
import pandas as pd

rnd_clf = RandomForestClassifier(n_estimators=500, n_jobs=1, random_state=42)
rnd_clf.fit(X, y)
a = {name: importance for name, importance in zip(NUMBER, rnd_clf.feature_importances_)}
df = pd.DataFrame(list(a.items()), columns=['name', 'importance'])
df2 = df.sort_values('importance', ascending=False)

不过在使用这个方法的过程中遇到了问题,想在这里寻求各位的技术解答。

内容的提问来源于stack exchange,提问作者acefoxy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:08:27