Problem 2: Predict Class Probabilities
Easypython
Learn the Concept: Naive BayesProblem Description
Write a Python program that trains a Naive Bayes classifier and prints the predicted probability for each class for a new data point.
Input
Training data and one new data point.
Output
The probability of each class for the new data point.
Constraints
- None specific.
Example Input
textX=[[1,60],[2,65],[8,95],[9,98]], y=[0,0,1,1], new=[[5,80]]
Example Output
textProbabilities [Fail, Pass]: [0.35 0.65]
Concepts Covered
.predict_proba().
Related Problems
- Problem 1: Train a Gaussian Naive Bayes ClassifierEasy · pythonSolve Problem
- Problem 3: Manually Apply Bayes' Theorem for ClassificationEasy · pythonSolve Problem
- Problem 4: Compare Naive Bayes and Logistic RegressionEasy · pythonSolve Problem