Learn R Programming

quanteda (version 0.9.4)

predict.textmodel_NB_fitted: prediction method for Naive Bayes classifier objects

Description

implements class predictions using trained Naive Bayes examples

Usage

## S3 method for class 'textmodel_NB_fitted':
predict(object, newdata = NULL, scores = c(-1,
  1), ...)

Arguments

object
a fitted Naive Bayes textmodel
newdata
dfm on which prediction should be made
scores
"reference" values when the wordscores equivalent implementation of Naive Bayes prediction is used. Default is c(-1, 1).
...
not used

Value

  • A list of two data frames, named docs and words corresponding to word- and document-level predicted quantities
  • docsdata frame with document-level predictive quantities: nb.predicted, ws.predicted, bs.predicted, PcGw, wordscore.doc, bayesscore.doc, posterior.diff, posterior.logdiff. Note that the diff quantities are currently implemented only for two-class solutions.
  • wordsdata-frame with word-level predictive quantities: wordscore.word, bayesscore.word