Teradata R Package Function Reference - NaiveBayes - Teradata R Package - Look here for syntax, methods and examples for the functions included in the Teradata R Package.

Teradata® R Package Function Reference

Product
Teradata R Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-28
dita:id
B700-4007
lifecycle
previous
Product Category
Teradata Vantage

Description

The NaiveBayesMap and NaiveBayesReduce functions generate a model from training data. A table of training data is input to the NaiveBayesMap function. Output of NaiveBayesMap is input to the NaiveBayesReduce function, which outputs the model.

Usage

  td_naivebayes_mle (
      formula = NULL,
      data = NULL
  )

Arguments

formula

Required Argument.
An object of class "formula". Specifies the model to be fitted. Only basic formula of the (col1 ~ col2 + col3 +...) form are supported and all variables must be from the same Teradata tbl object. The response should be column of type real, numeric, integer or boolean.

data

Required Argument.
This table defines the input training data.

Value

Function returns an object of class "td_naivebayes_mle" which is a named list containing Teradata tbl object.
Named list member can be referenced directly with the "$" operator using name: result

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load data
    loadExampleData("naivebayes_example1", "nb_iris_input_train")
    
     # Create remote tibble objects.
    nb_iris_input_train <- tbl(con, "nb_iris_input_train")

    #Run the train function
    naivebayes_train <- td_naivebayes_mle(formula=(species ~ petal_length + sepal_width + petal_width + sepal_length), 
                                      data=nb_iris_input_train)