本文介绍了使用整洁的文本和扫帚,但找不到LDA_VEM的整洁度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
tidytext本书中的示例带有主题模型的修饰符:
The tidytext book has examples with a tidier for topicmodels:
library(tidyverse)
library(tidytext)
library(topicmodels)
library(broom)
year_word_counts <- tibble(year = c("2007", "2008", "2009"),
+ word = c("dog", "cat", "chicken"),
+ n = c(1753L, 1157L, 1057L))
animal_dtm <- cast_dtm(data = year_word_counts, document = year, term = word, value = n)
animal_lda <- LDA(animal_dtm, k = 5, control = list( seed = 1234))
animal_lda <- tidy(animal_lda, matrix = "beta")
# Console output
Error in as.data.frame.default(x) :
cannot coerce class "structure("LDA_VEM", package = "topicmodels")" to a data.frame
In addition: Warning message:
In tidy.default(animal_lda, matrix = "beta") :
No method for tidying an S3 object of class LDA_VEM , using as.data.frame
来整理LDA_VEM类的S3对象的方法解决也看到的错误但是在这种情况下, library(tidytext)
存在
。
Replicating the error which is also seen here but in this instance library(tidytext)
is present.
下面是所有软件包的列表是它们的相应版本:
Below is a list of all packages are their corresponding version:
packageVersion("tidyverse")
‘1.2.1’
packageVersion("tidytext")
‘0.1.6’
packageVersion("topicmodels")
‘0.2.7’
packageVersion("broom")
‘0.4.3’
函数调用的输出 sessionInfo()
:
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] broom_0.4.3 tidytext_0.1.6 forcats_0.2.0 stringr_1.2.0 dplyr_0.7.4 purrr_0.2.4 readr_1.1.1 tidyr_0.8.0
[9] tibble_1.4.2 ggplot2_2.2.1 tidyverse_1.2.1 topicmodels_0.2-7
loaded via a namespace (and not attached):
[1] modeltools_0.2-21 slam_0.1-42 NLP_0.1-11 reshape2_1.4.3 haven_1.1.1 lattice_0.20-35 colorspace_1.3-2 SnowballC_0.5.1
[9] stats4_3.4.3 yaml_2.1.16 rlang_0.1.6 pillar_1.1.0 foreign_0.8-69 glue_1.2.0 modelr_0.1.1 readxl_1.0.0
[17] bindrcpp_0.2 bindr_0.1 plyr_1.8.4 munsell_0.4.3 gtable_0.2.0 cellranger_1.1.0 rvest_0.3.2 psych_1.7.8
[25] tm_0.7-3 parallel_3.4.3 tokenizers_0.1.4 Rcpp_0.12.15 scales_0.5.0 jsonlite_1.5 mnormt_1.5-5 hms_0.4.1
[33] stringi_1.1.6 grid_3.4.3 cli_1.0.0 tools_3.4.3 magrittr_1.5 lazyeval_0.2.1 janeaustenr_0.1.5 crayon_1.3.4
[41] pkgconfig_2.0.1 Matrix_1.2-12 xml2_1.2.0 lubridate_1.7.2 assertthat_0.2.0 httr_1.3.1 rstudioapi_0.7 R6_2.2.2
[49] nlme_3.1-131 compiler_3.4.3
推荐答案
删除.Rhistory和.RData纠正行为。
Deleting .Rhistory and .RData led to correct behaviour.
这篇关于使用整洁的文本和扫帚,但找不到LDA_VEM的整洁度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!