Computer scienceData scienceInstrumentsScikit-learnTraining ML models with scikit-learnClassification in scikit-learn

Naive Bayes with scikit-learn

Prior Probabilities

Report a typo

Note: This task assumes the use of scikit-learn version 1.2.2.


Use the iris dataset from the scikit-learn library. Create a GaussianNB model and specify the prior probabilities of the classes as [0.1, 0.1, 0.8]. Train the model, then calculate its accuracy and use this as your answer.

Use the code below to start your pipeline.

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB


X, y = load_iris(return_X_y = True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=2)
Enter a number

Create a free account to access the full topic