Description Usage Arguments Details Value Note Examples
mcLDA
runs multiple LDA models using parallel foreach
to fit each model.
The number of topics k
is varied over a predefined grid of values and
model selection is performed by calling internal compClass
function.
1 2 3 |
dtm |
a document-term matrix. |
lda.method |
character. Approximate posterior inference method. |
k.runs |
the grid of |
classes |
factor. The labeling variable for logistic classification. |
train.glmnet |
logical. If |
cv.parallel |
logical. If |
train.parallel |
logical. If |
This function runs multiple LDA models and applies logistic classification
by internal compClass
function to each model.
A vector of misclassification error on the test set (e1.test
) is returned and
the best model is selected with the minimum misclassification error.
a list containing the fitted LDA models and the misclassification errors. Model with the minimum misclassification error, i.e. the best model, is also returned.
By default the doParallel package uses snow-like functionality.
The snow-like functionality should work fine on Unix-like systems.
Actual version of mcLDA
function is built on Windows system.
In this system it is needed to pass to each core each used package.
Output is automatically saved in directory data/ws/output
and
a log file is provided in directory log
.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
library(Supreme)
data("dtm")
data("classes")
dtm.lognet <- reduce_dtm(dtm, method = "lognet", classes = classes)
# 4 cores: fit one model for each core.
mc.lda.models <- mcLDA(dtm.lognet$reduced, lda.method = "VEM", k.runs = list(from = 10, to = 25, steps = 5), classes = classes)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.