predict_class.Rd
Predict class using naive Bayes classifier.
predict_class(model, data, text) # S3 method for 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 |
# 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) # }