library(topicmodels) library(tidyverse) print(Sys.time()) # load("../community.RData") # d = phy_density$ALGAL_GROUP # d[, 2:ncol(d)] = round(d[, 2:ncol(d)]) # write_csv(d, 'phy_density_Group.csv') source('../code/AIC_model_selection.R') d = read_csv('../data/probs_phy.csv') UID = d$UID # dat = round(d[, -1]/1000) # str(dat) # mean(apply(dat, 2, mean)) # apply(dat, 2, function(x){sum(x > 0)/length(x)}) d = d %>% select(-UID) # d = round(d/1000) seed_number = 10 seeds = 2*seq(seed_number) best_ntopic = repeat_VEM(d, seeds, topic_min = 2, topic_max = 10),其中repeat_VEM函数是如何调用此功能的
时间: 2024-04-08 16:31:45 浏览: 7
根据提供的代码,repeat_VEM函数是通过传递参数d、seeds、topic_min和topic_max来调用的。这意味着repeat_VEM函数将使用数据集d和一系列不同的种子值seeds,以及主题数的最小值topic_min和最大值topic_max来执行主题建模过程。
具体来说,repeat_VEM函数会在给定的主题数范围内,使用每个种子值运行主题建模算法多次,并根据某种评估指标(例如AIC或BIC)选择最佳的主题数。该函数将返回一个表示最佳主题数的结果。
需要注意的是,在给定的代码片段中,并没有提供repeat_VEM函数的具体实现细节。如果您想了解repeat_VEM函数的具体实现,请查看AIC_model_selection.R文件中相关部分的代码。
相关问题
load(PETCTfution_seed50(parameter1).Rdata)
The error in your command is due to the fact that you are trying to load a file with a dynamic filename. In R, you can use variables in the `load()` function to specify the name of the file you want to load, but you need to make sure that the filename is a string.
Assuming that `PETCTfution_seed50(parameter1).Rdata` is the name of the file you want to load, you should enclose it in quotes like this:
```
load("PETCTfution_seed50(parameter1).Rdata")
```
Alternatively, you can use paste() function to concatenate a string with a variable like this:
```
filename <- paste("PETCTfution_seed50(", parameter1, ").Rdata", sep="")
load(filename)
```
This will create a string that combines the static and dynamic parts of the filename and then load the file with that name.
RStudio如何打开.RData
在RStudio中,你可以使用以下步骤打开.RData文件:
1. 在RStudio中打开一个新的R脚本。
2. 使用load()函数加载.RData文件。例如,如果你的.RData文件名为"mydata.RData",你可以使用以下代码加载它:
```
load("mydata.RData")
```
3. 如果你想将加载的数据分配给一个变量,你可以使用以下代码:
```
mydata <- load("mydata.RData")
```
这将把.RData文件中的数据加载到一个名为mydata的变量中。
请注意,当你加载.RData文件时,它将覆盖当前的工作区。因此,在加载.RData文件之前,请确保你已经保存了当前的工作区并且不需要其中的任何对象。