【问题标题】:How to extract top features by CATScore in r?如何在 r 中通过 CATScore 提取顶级特征?
【发布时间】:2019-07-17 02:41:26
【问题描述】:

我正在运行一个机器学习算法,它使用 CAT 分数进行特征选择

library(sda)
train1<- data.matrix(train, rownames.force = NA)
ranking.LDA = sda.ranking(train1[,1:lengthvar], train1[,lengthtrain], diagonal=FALSE)
topfs<-which(ranking.LDA[,"score"] >2)

我的问题是如何要求 CAT 分数给我例如前 20 个功能?我可以提取特征的唯一方法是设置一个阈值,但是这样,它为我提供了不同数据集的不同数量的特征。我想要的是总是有例如。前 20 个(或任何其他数量)功能。

提前感谢您的宝贵贡献。

【问题讨论】:

    标签: r feature-selection


    【解决方案1】:

    ranking.LDA 给出了一个数字列表。因此我们使用列表函数。

    #As ranking.LDA gives a ranking of predictors we directly extract column names using this ranking.
    colnames(train1[,ranking.LDA[1:20]])
    

    【讨论】:

      猜你喜欢
      • 2019-01-27
      • 1970-01-01
      • 2011-08-15
      • 1970-01-01
      • 2010-12-12
      • 2015-07-02
      • 2019-04-28
      • 1970-01-01
      • 2014-07-03
      相关资源
      最近更新 更多