lesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction loop
Write train(examples) where each example is (feature, label). Learn the threshold as the midpoint between the mean feature of the label-1 examples and the mean feature of the label-0 examples, and return it.