promptdojo_

The training and prediction loop — step 7 of 7

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Checkpoint: put the loop together. Write classify(train_data, new_inputs) that (1) learns a threshold from train_data (midpoint of the two class means), then (2) predicts a label for each value in new_inputs using 1 if value >= threshold else 0, and returns the list of predictions.

full-screen editor opens — close anytime to keep reading.