Gaussian Naive Bayes is a classification algorithm based on Bayes' theorem with a "naive" assumption that features are conditionally independent given the class. Each feature's likelihood is modeled as a Gaussian distribution, making it fast and effective for many real-world problems.
Given labeled training data and unlabeled test data, predict the class for each test sample by computing the posterior probability for each class.
Return one integer class label for each row of X_test.
Input: X_train = [[1], [2], [3], [10], [11], [12]], y_train = [0, 0, 0, 1, 1, 1], X_test = [[2], [11], [6]]
Output: [0, 1, 0]
Explanation: Each test value is assigned to the class with the larger Gaussian log posterior.
Input: X_train = [[0, 0], [1, 0], [0, 1], [10, 10], [11, 10], [10, 11]], y_train = [0, 0, 0, 1, 1, 1], X_test = [[0.5, 0.5], [10.5, 10.5]]
Output: [0, 1]
Group training rows by class before computing each feature mean and population variance.
Add log prior and per-feature Gaussian log likelihoods, then keep the largest class score.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: array
Gaussian Naive Bayes is a classification algorithm based on Bayes' theorem with a "naive" assumption that features are conditionally independent given the class. Each feature's likelihood is modeled as a Gaussian distribution, making it fast and effective for many real-world problems.
Given labeled training data and unlabeled test data, predict the class for each test sample by computing the posterior probability for each class.
Return one integer class label for each row of X_test.
Input: X_train = [[1], [2], [3], [10], [11], [12]], y_train = [0, 0, 0, 1, 1, 1], X_test = [[2], [11], [6]]
Output: [0, 1, 0]
Explanation: Each test value is assigned to the class with the larger Gaussian log posterior.
Input: X_train = [[0, 0], [1, 0], [0, 1], [10, 10], [11, 10], [10, 11]], y_train = [0, 0, 0, 1, 1, 1], X_test = [[0.5, 0.5], [10.5, 10.5]]
Output: [0, 1]
Group training rows by class before computing each feature mean and population variance.
Add log prior and per-feature Gaussian log likelihoods, then keep the largest class score.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: array