AREABEDSPRICE121043400216003330324003369414162232530004540x FEATURESy LABELx[0] areax[1] bedsy price1X = [r[:2] for r in rows]2y = [r[2] for r in rows]3print(X[0], y[0])4# [2104, 3] 400TRAINTEST21043400?
Table card: the dataset · one row per houseKhaki headers: features (inputs) · yellow header: the label (answer)Cells x[0], x[1] and y: one example as numbersFive house listings, each one example, hop into the dataset and become its rows. The AREA and BEDS columns are features, the inputs; the PRICE column is the label, the answer a model learns to predict. The first row splits into numbers: a feature vector x and a label y, and the Python card does the same split for every row. Four rows go to the training set and one to the test set; a new house arrives with x known and y unknown. The five houses are the first rows of the Portland housing table in Stanford CS229's lecture notes (A. Ng, T. Ma): living area in square feet, bedrooms, and price in thousands of dollars. The full table has 47 houses.

Examples

  1. Machine learning learns from data: a collection of examples. Ours are houses sold in Portland, Oregon. Each listing records three things: the living area, the number of bedrooms and the price the house sold for.

Features and labels

Using the data

What happens

;; step 1/9 · data
data      a collection of examples
example   one thing we measured: here, one house

each listing records:
  living area   in square feet
  bedrooms      a count
  price         what it sold for, in $1000s

The five houses are the first rows of the Portland housing table in Stanford CS229's lecture notes (A. Ng, T. Ma): living area in square feet, bedrooms, and price in thousands of dollars. The full table has 47 houses. The new house (1,800 square feet, 3 bedrooms) is made up for the example; it is not in the CS229 data.