【发布时间】:2020-05-18 04:43:46
【问题描述】:
我使用 lightgbm 来表示特征重要性。但是,输出是某个度量的绘图分数。我的问题是:
- x 轴的度量是什么?这是 F 分数还是其他?
- 如何获得特征输出,它可以显示每个特征对模型方差的影响(类似于 PCA)?
- 如何提取数据框格式中所有重要特征的指标?
这是我的代码:
import lightgbm as lgb
import matplotlib.pyplot as plt
lgb_params = {
'boosting_type': 'gbdt',
'objective': 'binary',
'num_leaves': 30,
'num_round': 360,
'max_depth':8,
'learning_rate': 0.01,
'feature_fraction': 0.5,
'bagging_fraction': 0.8,
'bagging_freq': 12
}
lgb_train = lgb.Dataset(X, y)
model = lgb.train(lgb_params, lgb_train)
plt.figure(figsize=(12,6))
lgb.plot_importance(model, max_num_features=30)
plt.title("Feature importances")
plt.show()
【问题讨论】:
标签: python machine-learning feature-selection hyperparameters lightgbm