crossval | R Documentation |
Cross-validate a fitted textmodel using k-fold cross-validation.
crossval(x, k = 5, by_class = FALSE, verbose = FALSE)
x |
a fitted textmodel |
k |
number of folds |
by_class |
logical; if |
verbose |
logical; if |
library("quanteda")
library("quanteda.textmodels")
dfmat <- tokens(data_corpus_moviereviews) |>
dfm()
tmod <- textmodel_nb(dfmat, y = data_corpus_moviereviews$sentiment)
crossval(tmod, k = 5, by_class = TRUE)
crossval(tmod, k = 5, by_class = FALSE)
crossval(tmod, k = 5, by_class = FALSE, verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.