106k views
22 votes
1. Create a naive Bayes model for this data set.

2. What prediction will the naive Bayes model return for the query q=(1,0,0)?



1 Answer

11 votes

Answer:

import the GaussianNB class from the scikit-learn naive bayes module using the import statement;

from sklearn.naivebayes import GaussianNB

create the classifier,

clf = GaussianNB()

Then train or fit a section of the dataset (the training set) with the classifier, then predict the label of the test section of the dataset with the provided query "q".

trained = clf.fit( train_features, train_label)

predict = clf.predict(q)

Step-by-step explanation:

The scikit-learn is a machine learning package in python used to create machine models from datasets. It has several classifiers and regressions algorithms.

The naive baye algorithm is a machine learning class in python used in supervised machine learning to create models used to predict a label given a set of features using a classifier.

User Stripies
by
5.9k points