predict.textmodel_wordmap {wordmap}R Documentation

Predict the most likely class of documents

Description

Predict document class using fitted Wordmap models.

Usage

## S3 method for class 'textmodel_wordmap'
predict(
  object,
  newdata = NULL,
  confidence = FALSE,
  rank = 1L,
  type = c("top", "all"),
  rescale = FALSE,
  min_conf = -Inf,
  min_n = 0L,
  ...
)

Arguments

object

a model fitted by textmodel_wordmap().

newdata

a dfm on which prediction will be made.

confidence

if TRUE, it returns likelihood ratio scores.

rank

rank of the class to be predicted. Only used when type = "top".

type

if top, returns the most likely class specified by rank; otherwise return a matrix of likelihood ratio scores for all possible classes.

rescale

if TRUE, likelihood ratio scores are normalized using scale(). This affects both types of results.

min_conf

returns NA when confidence is lower than this value.

min_n

set the minimum number of polarity words in documents.

...

not used.

Value

Returns predicted classes as a vector. If confidence = TRUE, it returns a list of two vectors:

class

predicted classes of documents.

confidence.fit

the confidence of predictions.


[Package wordmap version 0.8.0 Index]