【发布时间】:2020-05-27 08:27:50
【问题描述】:
我正在尝试使用 sparklyr 运行 LDA 模型。文档建议我可以在我的模型上使用函数 ml_describe_topics 来为每个主题提取最相关的单词,但是当我运行它时会出现错误。
我的代码示例如下:
library(sparklyr)
library(magrittr)
library(dplyr)
lda_model <- input_text %>%
ft_tokenizer(input_col = "text_data", output_col = "word_tokens") %>%
mutate(all_words = explode(word_tokens)) %>%
ml_lda(~all_words, k = 3, max_iter = 100)
lda_model %>% ml_describe_topics
我收到以下错误:
Error in model$describe_topics(max_terms_per_topic) : Error in model$describe_topics(max_terms_per_topic) :
attempt to apply non-function
Error in model$describe_topics(max_terms_per_topic) :
attempt to apply non-function
In addition: Warning message:
In do.call(.f, args, envir = .env) :
'what' must be a function or character string
谁能解释这里出了什么问题?我很困惑为什么该功能对我不起作用,尤其是当它遵循我可以找到的文档中的示例时。
【问题讨论】:
标签: r machine-learning topic-modeling sparklyr