tidy_naive_bayes: Train a Tidy Naive Bayes classifier model

Description Usage Arguments Value See Also Examples

View source: R/tidy_naive_bayes.R

Description

Train a Tidy Naive Bayes classifier model

Usage

1
2
3
4
5
6
7
8
## Default S3 method:
tidy_naive_bayes(x, y)

## S3 method for class 'formula'
tidy_naive_bayes(formula, data)

## S3 method for class 'tbl_df'
tidy_naive_bayes(.data, class_var)

Arguments

x

A data frame.

y

A vector.

formula

An object of class 'formula' of the form 'class ~ predictors'.

data

A data frame.

Value

A Tidy Naive Bayes classifier model.

See Also

predict.tidy_naive_bayes()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(tibble)
data(iris)
model <- tidy_naive_bayes(Species ~ ., iris)

new_flowers <- tribble(
  ~Sepal.Length, ~Sepal.Width, ~Petal.Length, ~Petal.Width,
            5.3,          3.4,           1.6,          0.3,
            7.7,          3.9,           6.3,          2.1
)

predict(model, new_flowers)
predict(model, new_flowers, type = "prob")

datascienceworkshops/tidynaivebayes documentation built on May 23, 2019, 7:31 a.m.