- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
因此,我尝试使用 tidytext 包进行二元组主题建模,按照 tidytext 网站上的步骤进行操作:https://www.tidytextmining.com/ngrams.html 。
我能够到达“word_counts”部分,其中 R 计算每个二元词组的频率。
“word_counts”返回以下内容:
customer_id word n
<chr> <chr> <int>
1 00000001234 sample text 45
2 00000002345 good morning 30
3 00000003456 happy friday 24
下一步是将上面的信息放入 dtm 格式
我的代码如下:
lda_dtm <- word_counts %>%
cast_dtm(customer_id, word, n)
发出警告消息:
Warning message:
Trying to compute distinct() for variables not found in the data:
- `row_col`, `column_col`
This is an error, but only a warning is raised for compatibility reasons.
The operation will return the input unchanged.
但是“lda_dtm”看起来格式正确。
lda_dtm
<<DocumentTermMatrix (documents: 9517, terms: 341545)>>
Non-/sparse entries: 773250/3249710515
Sparsity : 100%
Maximal term length: NA
Weighting : term frequency (tf)
但是,当我尝试运行 lda 时,它不起作用。
burnin <- 4000
iter <- 300
thin <- 500
seed <-list(2003,5,63,100001,765)
nstart <- 5
best <- TRUE
k <- 6
out_LDA <- LDA(lda_dtm,
k = k,
method="Gibbs",
control = list(nstart=nstart,
seed = seed,
best=best,
burnin = burnin,
iter = iter,
thin = thin))
提出了以下警告:
Error in seq.default(CONTROL_i@iter, control@burnin + control@iter, by = control@thin) :
wrong sign in 'by' argument
我在整洁的文本网站上没有看到bi-grams的主题建模教程,该教程是专门针对unigrams的。我应该如何调整格式以使其与bi-grams一起使用?
最佳答案
1:你从cast_dtm得到的消息实际上来自cast_sparse。 github 上有两个问题 #120 和 #121 处理这个问题。目前,该问题已在 github 上的包中修复,但尚未发布。
如果你愿意,你可以从 github 安装它 devtools::install_github("juliasilge/tidytext")
.
2:你从LDA得到的错误与1无关。如果你只是运行out_LDA <- LDA(lda_dtm, k = k)
LDA 会运行得很好。问题出在你的控制选项 thin
。这应该小于或等于 iter 参数。在你的例子中,它设置为 500,而 iter 设置为 300。因此会出现错误。您可以看到当 Thin 比 iter 高 1 时出现错误。
关于r - 如何在 r 中使用整洁的文本进行二元模型主题建模?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51106727/
我正在使用这种代码: document.write("foo 使用 HTML tidy 后,表格外的 script 标签被移除,因此破坏了页面布局。我
我正在为我的网格系统使用 Bourbon 的 Neat 库。 我有这样的代码: section { @include outer-container; aside { @include spa
我有三个文件。 header.php index.php footer.php 头文件包含来自至 索引文件包含页面内容页脚文件包含 至 它们一起包含一个带有 PHP 的普通 HTML 文件 当我使用
我有一个格式有点乱的 Objective-C 代码库。有没有办法让 Xcode 重新格式化整个项目以符合编码标准(即正确缩进、空格与制表符等)?是否有其他工具可以完成此任务? 最佳答案 去壳化:htt
我试图自己实现整洁,使用原始论文但被卡住了。 假设在上一代我有以下物种: Specie 1: members: 100 avg_score: 100 Specie 2: memb
我正在尝试整理我的一些 SKScene 代码。目前我有大约 11 个对 SKNode 的引用(有些是包含子节点的层)。这些节点及其子节点被类频繁访问。我考虑这样做的方式是: 将所有 SKNode 子类
Notepad++ 的 HTML Tidy 坏了吗?除了 Tidy(第一个)之外,所有命令都不起作用。他们不显示任何消息,即使选择了所有文本。我真的需要 Tidy 才能工作,还是它只是最新版本 N++
有没有一种方法可以不使用 rowwise() 来创建 key? 非常感谢任何指针。 df % rowwise %>% mutate(key=paste(sort(c(grp1, grp2)), col
我正在尝试使用作为 PHP (http://www.php.net/manual/en/book.tidy.php) 一部分的 HTML Tidy 实现来重新格式化大量 HTML。我遇到了一个问题,其
我为 Sublime Text 2 安装了 phptidy 插件,并尝试用它来清理一些丑陋的代码,比如 $tdt="
我在 Windows 的命令行环境中使用 HTML Tidy。我需要强制将一些 html 文件转换为 xml,即使有错误也是如此。 我执行以下步骤: 创建文件“conf.txt”,其内容为: 强制输出
我正在重写一个使用 Bourbon 的“旧”React 原型(prototype),它还在 gulpfile 中使用 gulp-sass 来注入(inject)节点整洁的依赖项: var sassOp
我正在创建一个供个人使用的 jQuery Accordion 插件。 我的主要目标是拥有 super 简洁的 JS 代码和 HTML 结构。 这就是我已经走了多远 http://jsfiddle.ne
我正在测试 Bourbon Neat,我在一个外容器中有两列,我希望这些列的高度相等(与最高的列一样高)。在短列上使用 @include fill-parent 不起作用,它只会使它与外部容器一样宽。
大多数时候在 repos 中,我们看到一个 PR,然后是那个 PR 的 merge 提交,它只是说“Merged pull request #XXX from ...”。 但最近,我看到了一个紧凑的版
我正在使用 Neat 的 12 列网格。该页面由延伸整个网格宽度的部分组成。部分背景与页面背景不同: 如您所见,粉红色部分的左侧与网格边缘齐平。我想要的是该部分的左侧超出网格几个雷姆。 但是,如果我添
只是出于好奇而提出的简单问题。 类上的多个方法需要使用字符串流,或者特别是 ostringstream。 1) 有一个 stringstream 变量作为类成员,然后在使用它之前清除它,即 msg.s
我是波旁/整洁的新手。我有一个关于嵌套的问题:我希望红色框填充整个宽度,而彼此之间不要有排水沟。当在其上使用“@include omega”时,第一个框将删除其右边距,但是右边的框仍具有边距,并且不会
GWT(Google Web Toolkit)是否有一个功能可以漂亮地打印小部件的 html 输出? (如果问题措辞不当,我深表歉意——我不是 GWT 开发人员,但我们的开发人员声称没有办法做到这一点
我是一名优秀的程序员,十分优秀!