GBM R函数:为每个类分别获取变量重要性 [英] GBM R function: get variable importance separately for each class
问题描述
我在R中使用 gbm 函数( gbm软件包)以适合用于多类分类的随机梯度增强模型.我只是想分别获取每个类别的每个预测变量的重要性,就像在
I am using the gbm function in R (gbm package) to fit stochastic gradient boosting models for multiclass classification. I am simply trying to obtain the importance of each predictor separately for each class, like in this picture from the Hastie book (the Elements of Statistical Learning) (p. 382).
但是,函数summary.gbm
仅返回预测变量的总体重要性(其重要性在所有类别中平均).
However, the function summary.gbm
only returns the overall importance of the predictors (their importance averaged over all classes).
有人知道如何获得相对重要性值吗?
Does anyone know how to get the relative importance values?
推荐答案
I think the short answer is that on page 379, Hastie mentions that he uses MART, which appears to only be available for Splus.
我同意gbm软件包似乎不允许看到单独的相对影响.如果您对多类问题感兴趣,那么可以通过为每个类构建一个vs全部gbm,然后从每个模型中获取重要性指标来获得类似的结果.
I agree that the gbm package doesn't seem to allow for seeing the separate relative influence. If that's something you're interested in for a mutliclass problem, you could probably get something pretty similar by building a one-vs-all gbm for each of your classes and then getting the importance measures from each of those models.
因此,假设您的课程是a,b,c和& d.您可以对其他模型进行建模,并从该模型中获得重要性.然后,您对b与其他模型进行建模,并从该模型中获得重要性.等等.
So say your classes are a, b, c, & d. You model a vs. the rest and get the importance from that model. Then you model b vs. the rest and get the importance from that model. Etc.
这篇关于GBM R函数:为每个类分别获取变量重要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!