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

Teradata® Python Package Function Reference

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-07-17
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.mle.NaiveBayes = class NaiveBayes(builtins.object)
     Methods defined here:
__init__(self, formula=None, data=None, data_sequence_column=None, data_order_column=None)
DESCRIPTION:
    The NaiveBayesMap and NaiveBayesReduce functions generate a model from
    training data. A virtual data frame of training data is input to
    the NaiveBayesMap function, whose output is the input to
    NaiveBayesReduce function, which outputs the model.
 
 
PARAMETERS:
    formula:
        Required Argument.
        A string consisting of "formula". Specifies the model to be fitted. Only
        basic formula of the "col1 ~ col2 + col3 +..." form is supported and
        all variables must be from the same virtual data frame object. The
        response should be column of type real, numeric, integer or boolean.
        Types: str
 
    data:
        Required Argument.
        This is teradataml DataFrame defining the input training data.
 
    data_order_column:
        Optional Argument.
        Specifies Order By columns for data.
        Values to this argument can be provided as a list, if multiple
        columns are used for ordering.
        Types: str OR list of Strings (str)
 
    data_sequence_column:
        Optional Argument.
        Specifies the list of column(s) that uniquely identifies each row of
        the input argument "data". The argument is used to ensure
        deterministic results for functions which produce results that vary
        from run to run.
        Types: str OR list of Strings (str)
 
RETURNS:
    Instance of NaiveBayes.
    Output teradataml DataFrames can be accessed using attribute
    references, such as NaiveBayesObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
 
RAISES:
    TeradataMlException
 
 
EXAMPLES:
    # Load the data to run the example
    load_example_data("NaiveBayes","nb_iris_input_train")
 
    # Create teradataml DataFrame object.
    nb_iris_input_train = DataFrame.from_table("nb_iris_input_train")
 
    # Run the train function
    naivebayes_train = NaiveBayes(formula="species ~ petal_length + sepal_width + petal_width + sepal_length",
                                  data=nb_iris_input_train)
 
    # Print the result DataFrame
    print(naivebayes_train.result)
__repr__(self)
Returns the string representation for a NaiveBayes class instance.