我在我的数据上运行了XGBoost算法,发现有15个特征是重要的。我重命名了我的数据帧中的列,然后再次运行相同的XGBoost算法,注意到我重要的features.The顺序的变化在矩阵中稍微混乱了一些,并且出现了2-3个新变量。这在很大程度上是相同的,但我想知道是什么导致了功能重要性的这种变化,因为我只更改了列的名称。我使用tree shap来查找特征重要性,下面是我如何重命名列的方法。
colnames = pd.read_csv("kbmg_colnames.csv")
d = dict(zip(colnames['Actual'], colnames['To be changed']))
Data_test = Data_test.rename(columns=d)
发布于 2019-08-13 15:41:29
几乎每个ML算法都有一个random_state。
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任务使用此方法。
https://stackoverflow.com/questions/57473183
复制相似问题