Skip to content

Commit

Permalink
change parameter order in lda filename
Browse files Browse the repository at this point in the history
  • Loading branch information
lkoppers committed Mar 13, 2019
1 parent 903e2ca commit 1e5686f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/LDAgen.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ LDAgen <- function(documents, K = 100L, vocab, num.iterations = 200L,
ttw <- rbind(round(t(result$topic_sums / sum(result$topic_sums))*100,2), ttw)
}
rownames(ttw) <- c("Topic", 1:num.words)
write.csv(ttw, file = paste(folder, "-k", K, "i", num.iterations, "b", burnin, "s",
seed, "alpha", round(alpha,2), "eta", round(eta,2), ".csv", sep = ""), fileEncoding="UTF-8")
write.csv(ttw, file = paste(folder, "-k", K, "alpha", round(alpha,2), "eta", round(eta,2), "i", num.iterations, "b", burnin, "s",
seed, ".csv", sep = ""), fileEncoding="UTF-8")
invisible(result)
}

2 changes: 1 addition & 1 deletion tests/testthat/test_LDAgen.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ load("data/LDAdoc_compare.RData")

csvTest <- read.csv("data/test-k3i20b70s24602alpha0.33eta0.33_orig.csv")
counttest <- LDAgen(documents=LDAdoc, K = 3L, vocab=wordlist$words, num.iterations = 20L, burnin = 70L, seed=24602, num.words = 10L, LDA = TRUE, count=TRUE)
csvTest2 <- read.csv(file.path(tempdir(),"lda-result-k3i20b70s24602alpha0.33eta0.33.csv"))
csvTest2 <- read.csv(file.path(tempdir(),"lda-result-k3alpha0.33eta0.33i20b70s24602.csv"))
expect_equal(csvTest, csvTest2)

expect_equal(lda1, LDAgen(documents=LDAdoc, K = 3L, vocab=wordlist$words, num.iterations = 20L, burnin = 70L, seed=24601, num.words = 10L, LDA = TRUE))
Expand Down

0 comments on commit 1e5686f

Please sign in to comment.