One-vs-Rest Multiclass Wrapper

medium
Checkpoint challenge
Solve this to show you know the material and jump straight to Unit 11. Everything before it counts as cleared.

Turn any binary scorer into a multiclass classifier: train one model per class (that class vs everything else) and predict the class whose model is most confident.

Implement:

  • fit_logistic(X, y, lr=0.1, epochs=500): binary logistic regression by full-batch gradient descent from zeros, returning (w, b)
  • OneVsRest().fit(X, y) and .predict(X): use fit_logistic for each class (in sorted order) and pick the class with the highest score X @ w + b
#classification#multiclass#logistic-regression2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
One-vs-Rest Multiclass Wrapper · TechGradify