【问题标题】:MARS feature importance returns nullMARS 特征重要性返回 null
【发布时间】:2021-01-29 18:18:34
【问题描述】:

我一直在使用Py-earth模型,url可以在这里找到:

然后跟随这个 turorial here

我已经成功地训练了:

model = Earth(max_degree=2, penalty=0.5, minspan_alpha =1, endspan_alpha =1,allow_linear=False,check_every=1,verbose=True)
model.fit(X_train,y_train)

但是当使用model.summary_feature_importances(sort_by='gcv') 时,它会返回一个空数组,它不应该这样做,因为它在教程中提供了这样的结果:

            nb_subsets    gcv    rss
lstat       0.42          0.78   0.78   
rm          0.25          0.12   0.12   
crim        0.17          0.06   0.06   
dis         0.17          0.04   0.04   
black       0.00          0.00   0.00   
ptratio     0.00          0.00   0.00   
tax         0.00          0.00   0.00   
rad         0.00          0.00   0.00   
age         0.00          0.00   0.00   
nox         0.00          0.00   0.00   
chas        0.00          0.00   0.00   
indus       0.00          0.00   0.00   
zn          0.00          0.00   0.00   

本教程可以在here找到。

【问题讨论】:

标签: python machine-learning regression


【解决方案1】:

我遇到了同样的问题。

相信你在调用Earth()时需要设置feature_importance_type参数。

试试这个:

model = Earth(feature_importance_type='gcv', max_degree=2, penalty=0.5, minspan_alpha =1, endspan_alpha =1,allow_linear=False,check_every=1,verbose=True)
model.fit(X_train,y_train)

model.summary_feature_importances(sort_by='gcv')

【讨论】:

    猜你喜欢
    • 2020-03-31
    • 2018-12-14
    • 2021-12-23
    • 2018-09-23
    • 2015-01-06
    • 2019-02-28
    • 2021-02-03
    • 2016-11-07
    • 1970-01-01
    相关资源
    最近更新 更多