Skip to content
C

Problem 4: Compare Naive Bayes and Logistic Regression

Easypython

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.

Input (stdin)

Output

Run your code to see output here...