Description Usage Arguments Examples
Predict class using naive Bayes classifier.
1 2 3 4 | predict_class(model, data, text)
## S3 method for class 'naive_bayes_model'
predict_class(model, data, text)
|
model |
A naive Bayes classifier as returned by
|
data |
A data.frame containing |
text |
Text to train model on |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
init_textanalysis()
classes <- factor(c("financial", "legal"))
model <- init_naive_classifer(classes)
train <- tibble::tibble(
text = c("this is financial doc", "this is legal doc"),
labels = factor("financial", "legal")
)
train_naive_classifier(model, train, text, labels)
test <- tibble::tibble(
text = "this should be predicted as a legal document"
)
predict_class(model, test, text)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.