Skip to content
CampusEduX

Problem 1: Train a Gaussian Naive Bayes Classifier

Easypython
Learn the Concept: Naive Bayes

Problem Description

Write a Python program that trains a Gaussian Naive Bayes classifier on a labeled numeric dataset, and predicts the class for a new data point.

Input

A labeled dataset and one new data point.

Output

The predicted class.

Constraints

  • At least 6 labeled training examples.

Example Input

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

Example Output

text
Prediction: [1]

Concepts Covered

GaussianNB, .fit(), .predict().

Related Problems

  • Problem 2: Predict Class Probabilities
    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...