首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >XGBoost算法:重命名列后的特征重要性更改

XGBoost算法:重命名列后的特征重要性更改
EN

Stack Overflow用户
提问于 2019-08-13 15:38:23
回答 1查看 238关注 0票数 1

我在我的数据上运行了XGBoost算法,发现有15个特征是重要的。我重命名了我的数据帧中的列,然后再次运行相同的XGBoost算法,注意到我重要的features.The顺序的变化在矩阵中稍微混乱了一些,并且出现了2-3个新变量。这在很大程度上是相同的,但我想知道是什么导致了功能重要性的这种变化,因为我只更改了列的名称。我使用tree shap来查找特征重要性,下面是我如何重命名列的方法。

代码语言:javascript
运行
复制
colnames = pd.read_csv("kbmg_colnames.csv")
d = dict(zip(colnames['Actual'], colnames['To be changed']))
Data_test = Data_test.rename(columns=d)
EN

回答 1

Stack Overflow用户

发布于 2019-08-13 15:41:29

几乎每个ML算法都有一个random_state。

代码语言:javascript
运行
复制
random_state : int, RandomState instance or None, optional (default=None)

    If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

要在每次运行中获得相同的结果,您必须将其设置为某个数字: random_state=42。强烈建议对每个ML任务使用此方法。

Random state (Pseudo-random number) in Scikit learn

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57473183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档