A Taste of Machine Learning

Try machine learning the honest way: a model is a program that guesses from examples. You'll train one to guess how much lemonade a stand will sell from the day's temperature, then hold some days back to find out how wrong its guesses are, and when not to trust it. The chapter ends with where to go next.

Updated

Models in Python

  1. A Model That Guesses (Apprentice): A machine learning model is a rule a program learns from examples instead of one you write, and scikit-learn's LinearRegression learns one from a lemonade stand's summer with fit, then guesses the cups a day will sell with predict.
  2. How to Tell When a Model Is Wrong (Apprentice): Hold some examples back with train_test_split and a fixed random_state, measure the model's guesses on them with the mean absolute error, and see why a score on the training data misleads and when a model's guesses shouldn't be trusted at all.

Exercise: Lemonade Stand Forecast

  1. Exercise: Lemonade Stand Forecast (Apprentice): Hold back some of a lemonade stand's summer for testing, train a straight-line model with scikit-learn on the rest, turn temperatures into guesses, and measure how far off they are, while pytest checks each function.