Skip to content
CampusEduX

Problem 4: Compare Naive Bayes and Logistic Regression

Easypython
Learn the Concept: Naive Bayes

Problem Description

Write a Python program that trains both a Gaussian Naive Bayes model and a Logistic Regression model on the same dataset, and compares their predictions on the same new data point.

Input

A labeled dataset and one new data point.

Output

Predictions from both models.

Constraints

  • At least 8 labeled training examples.

Example Input

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

Example Output

text
Naive Bayes prediction: [1] Logistic Regression prediction: [1]

Concepts Covered

GaussianNB, LogisticRegression, model comparison.

Related Problems

  • Problem 1: Train a Gaussian Naive Bayes Classifier
    Easy · python
    Solve Problem
  • Problem 2: Predict Class Probabilities
    Easy · python
    Solve Problem
  • Problem 3: Manually Apply Bayes' Theorem for Classification
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...