"""Lesson 14 starter: convert scores into hard class predictions."""
import numpy as np

scores = np.array([-1.2, 0.4, 2.0, -0.1, 0.8])
y = np.array([-1, 1, 1, 1, -1])

# TODO 1: predict +1 when score >= 0 and -1 otherwise.
pred = np.where(scores >= 0, 1, -1)

# TODO 2: compute the fraction of predictions that disagree with y.
error_rate = np.mean(pred != y)

print("predicted labels =", pred)
print("classification error rate =", error_rate)
