Naive Bayes Model | BYOM | Teradata Vantage - 3.0 - Naive Bayes Model - Teradata Vantage

Teradata Vantageā„¢ - Bring Your Own Model User Guide

Product
Teradata Vantage
Release Number
3.0
Published
May 2022
Last Update
2022-06-02
Content Type
User Guide
Publication ID
B700-1111-051K
Language
English (United States)

This Python pipeline creates a PMML Naive Bayes model. The scikit-learn function load_iris loads the dataset into an object.

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn2pmml import sklearn2pmml
from sklearn2pmml.pipeline import PMMLPipeline
 
pmml_pipeline=PMMLPipeline([("classifier",GaussianNB())])
iris=load_iris()
pmml_pipeline.fit(iris.data,iris.target)
sklearn2pmml(pmml_pipeline,"../sql/iris_db_naive_bayes_model.pmml",with_repr=True)