WRITE · TRACE · UNDERSTAND

Logistic Regression

Turn a score into a probability and learn a binary boundary

Your experiment

fit(xs, ys, steps, rate) starts w=b=0 and returns (w, b). Use sigmoid(w*x+b) and gradients mean((p-y)*x), mean(p-y) for binary cross-entropy. Inputs in this lab have moderate scores.

Python runs in your browser. Your draft stays on this device.

What to look for

The sigmoid maps a real score into (0,1). For binary cross-entropy its derivative with respect to the score is p-y. The trace shows the parameters and mean squared probability residual as a diagnostic, not as the optimized loss.

Watch your code work

Ready to experiment

Write a solution or load the worked answer, then choose Trace & check.

Step through arrays, variables and training curves produced by your own Python.