1

我正在使用 quanteda 包来构建 DFM,以便在 dfm 上训练模型,以便我可以预测新的未知数据集的值。只要两组具有相同数量的特征,使用 predict() 就可以正常工作,否则我会收到此错误:

Cholmod 错误“A 和 B 内部尺寸必须匹配”

为了确保特征的数量相同,可以使用 dfm 函数中的 selectFeatures 或参数 keepFeatures。

我的问题是我根本找不到这些功能。我有:

  • 重新安装了 quanteda 包。

  • 重新启动R。

  • 确保我有最新的包版本 1.2.0

  • 检查了 quanteda 的 github 页面以检查这些功能是否已被删除。

一切都无济于事。我得到的只是这些错误消息:

    textVec1 <- c("This is text one.", "This, the second text.", "Here: the third text.")
    textVec2 <- c("Here are new words.", "New words in this text.")
    dfm1 <- dfm(textVec1)
    dfm2a <- dfm(textVec2)
    dfm2b <- dfm(textVec2, keptFeatures = dfm1)

警告信息:

1:未使用自变量保持特征。

2:未使用自变量保持特征。

    dfm <- selectFeatures(dfm1, features = dfm2)

selectFeatures 中的错误(dfmshort,features = dfmacts):找不到函数“selectFeatures”

我需要额外的包来运行这些功能吗?

4

0 回答 0