Skip to content
C

Problem 1: Train a Basic Logistic Regression Classifier

Easypython

Problem Description

Write a Python program that trains a Logistic Regression model to predict pass/fail based on hours studied, then predicts the class for 2 new students.

Input

Training data (hours studied and pass/fail labels), and 2 new hour values.

Output

The predicted class labels for the 2 new students.

Constraints

  • At least 6 labeled training examples.

Example Input

text
hours = [[1],[2],[3],[7],[8],[9]], labels=[0,0,0,1,1,1], new=[[4],[8.5]]

Example Output

text
Predictions: [0 1]

Concepts Covered

LogisticRegression, .fit(), .predict().

Input (stdin)

Output

Run your code to see output here...