Challenge - 5 Problems
Naive Bayes Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
How does Naive Bayes handle feature independence?
Naive Bayes assumes that features are independent given the class. What does this mean in simple terms?
Attempts:
2 left
❓ Predict Output
intermediate2:00remaining
Output of Naive Bayes prediction code
What is the predicted class output by this code snippet?
ML Python
from sklearn.naive_bayes import GaussianNB import numpy as np X_train = np.array([[1, 20], [2, 21], [3, 22], [4, 23]]) y_train = np.array([0, 0, 1, 1]) model = GaussianNB() model.fit(X_train, y_train) X_test = np.array([[1.5, 20.5]]) prediction = model.predict(X_test) print(prediction[0])
Attempts:
2 left
❓ Hyperparameter
advanced1:30remaining
Choosing the smoothing parameter in Naive Bayes
In Multinomial Naive Bayes, what effect does increasing the smoothing parameter alpha have on the model?
Attempts:
2 left
❓ Metrics
advanced1:30remaining
Evaluating Naive Bayes with imbalanced data
You trained a Naive Bayes classifier on imbalanced classes. Which metric is best to evaluate its performance fairly?
Attempts:
2 left
🔧 Debug
expert2:00remaining
Why does this Naive Bayes code raise an error?
What error does this code raise and why?
ML Python
from sklearn.naive_bayes import GaussianNB X_train = [[1, 2], [3, 4]] y_train = [0, 1, 0] model = GaussianNB() model.fit(X_train, y_train)
Attempts:
2 left