Pass or Fail?

Machine Learning in CodeEasy+10 XP+10

Pass or Fail?

A tutor recorded how many hours each student studied (hours) and whether they passed (passed: 1 for pass, 0 for fail).

Write predict_pass(hours, passed, new_hours).

  • Build make_pipeline(StandardScaler(), LogisticRegression(max_iter=1000)).
  • Fit it with hours as the only feature.
  • Predict pass (1) or fail (0) for every value in new_hours, in order.

Return the predictions as a list of ints.

Examples

hours = [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
passed = [0, 0, 0, 0, 1, 0, 1, 1, 1, 1]
new_hours = [0.8, 4.8]
returns [0, 1]
hours = [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
passed = [0, 0, 0, 0, 1, 0, 1, 1, 1, 1]
new_hours = [3.3, 1.2]
returns [1, 0]

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run