Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Naive Bayes classifier from scikit-learn.
ML Python
from sklearn.naive_bayes import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to create a Gaussian Naive Bayes model instance.
ML Python
model = [1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the code to train the Naive Bayes model on features X_train and labels y_train.
ML Python
model.[1](X_train, y_train) Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to predict labels for X_test and calculate accuracy score.
ML Python
predictions = model.[1](X_test) accuracy = accuracy_score(y_test, [2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a dictionary of class prior probabilities from the trained model.
ML Python
class_priors = {cls: prob for cls, prob in zip(model.[1], model.[2])}
print(class_priors[[3]]) Drag options to blanks, or click blank then click option'
Attempts:
3 left