nb_keywords: Train a naive bayes classifier and extract keywords as...

View source: R/firststage_functions.R

nb_keywordsR Documentation

Train a naive bayes classifier and extract keywords as data.frame object ordered by most predictive word of class on top (wrapper function around Quanteda commands). The returned data.frame has three columns: word, 0(=posterior prob of word indicating that document in classvar==0), 1(=posterior prob of word predicting word indicating that document in classvar==1), and id.

Description

Train a naive bayes classifier and extract keywords as data.frame object ordered by most predictive word of class on top (wrapper function around Quanteda commands). The returned data.frame has three columns: word, 0(=posterior prob of word indicating that document in classvar==0), 1(=posterior prob of word predicting word indicating that document in classvar==1), and id.

Usage

nb_keywords(training, classvar, distribution = "Bernoulli")

Arguments

training

Training data feature matrix

classvar

Classification variable name, entered as string


gidonc/durhamevp documentation built on April 8, 2022, 10:31 a.m.