Skip to content
CampusEduX

Problem 2: Predict Class Probabilities

Easypython
Learn the Concept: Naive Bayes

Problem 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

text
X=[[1,60],[2,65],[8,95],[9,98]], y=[0,0,1,1], new=[[5,80]]

Example Output

text
Probabilities [Fail, Pass]: [0.35 0.65]

Concepts Covered

.predict_proba().

Related Problems

  • Problem 1: Train a Gaussian Naive Bayes Classifier
    Easy · python
    Solve Problem
  • Problem 3: Manually Apply Bayes' Theorem for Classification
    Easy · python
    Solve Problem
  • Problem 4: Compare Naive Bayes and Logistic Regression
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...