Data as a Matrix: Rows, Features and the Target · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.
به انگلیسی

Shaping data into rows and columns

Computing · Machine Learning · ages 18-20
Name ______________________   Date ____________
  1. A study predicts each plant's final height from its species, light and watering. What should one training row describe?

    • One plant, with its inputs and matching height
    • One light level, with inputs from many plants
    • One species, with its label but no final height
  2. A one-hot district matrix uses only known categories and has no missing values. What does 0 in the Oak flag tell you about a row?

    • The category is Oak, stored with a smaller value
    • The category is one of the other known groups
    • The category is missing from the input row
    • The category has two matching district flags
  3. Parcel P has a delivery-time target of 2 days; parcel Q has a target of 5 days. After sorting the feature rows into order Q, P, which target order keeps the examples matched?

    • 5 days, then 2 days
    • 2 days, then 5 days
    • 5 days for both parcels
    • 2 days for both parcels
  4. A table has one row per sensor. Columns are temperature, humidity, voltage, in that order. Counting rows and columns from 1, what does row 3, column 2 contain?

    • The temperature reading recorded by sensor 3
    • The humidity reading recorded by sensor 3
    • The voltage reading recorded by sensor 2
  5. A table stores delay_s and delay_ms, with delay_ms exactly equal to delay_s times 1000 in every row. The milliseconds column supplies a new measurement that cannot be recovered from the seconds column.

    Circle one:   True   False

  6. Raw logs list individual cinema visits. You want to predict total popcorn sales for each showing before it starts. What should one training row represent?

    • One showing, with pre-show inputs and its total sales
    • One visitor, with pre-show inputs and their purchases
    • One cinema day, with pre-show inputs and a day's sales
  7. District flags are ordered Oak, River, Field. Each complete row has exactly one known district. What is the one-hot feature vector for a River row?

    • (1, 0, 0)
    • (0, 0, 1)
    • (0, 1, 0)
    • (1, 1, 1)
  8. Raw distance is the sum of absolute feature differences. Two rows have incomes 42000 and 47000, and schooling values 6 and 8. Which feature contributes more to this distance?

    • Schooling: its gap of 2 exceeds the income gap of 5000
    • Income: its gap of 5000 exceeds the schooling gap of 2
    • Both: each has one gap, so their contributions are equal
  9. Predict a shop's daily sales at opening. A row contains an ID used only as a label, opening stock, opening bookings, closing receipts and daily sales. Which columns belong in X?

    • Opening stock, bookings and sales
    • Closing receipts and the record ID
    • Opening stock and opening bookings
  10. Jo splits rows into training and test sets, then computes scaling minima and maxima using both sets. Which change keeps test information out of fitting the scaler?

    • Fit on training rows only; apply that scaler to both sets
    • Fit on each set separately; apply its own scaler to that set
    • Fit on test rows only; apply that scaler to training rows
LightMySky · lightmysky.comW1-mt_KEN-TU1Gpn-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Shaping data into rows and columns W1-mt_KEN-TU1Gpn-s1

  1. One plant, with its inputs and matching height · The target is a final height for one plant, so one row describes that plant and has its corresponding target.
  2. The category is one of the other known groups · A flag is 1 for a match and 0 otherwise. With complete, known categories, Oak flag 0 means the row belongs to another district.
  3. 5 days, then 2 days · Q's target must stay with Q and P's target with P. Row order Q, P therefore requires targets 5 days, then 2 days.
  4. The humidity reading recorded by sensor 3 · Row 3 selects sensor 3. Column 2 selects humidity, so the cell contains that sensor's humidity reading.
  5. False · Multiplying delay_s by 1000 recovers delay_ms exactly. The extra column adds no independent measurement, though keeping it can change a model's weighting.
  6. One showing, with pre-show inputs and its total sales · The prediction is a total for one showing. Combine visit records at that level, use inputs available before the showing, and keep its total as the target.
  7. (0, 1, 0) · River matches the middle flag. Oak and Field do not match, so their flags are 0 and the vector is (0, 1, 0).
  8. Income: its gap of 5000 exceeds the schooling gap of 2 · Under the stated rule, income contributes 5000 and schooling contributes 2. Income contributes more for this pair; ranges alone would not prove that for every pair.
  9. Opening stock and opening bookings · Opening stock and bookings are known at prediction time. Daily sales belongs in y, closing receipts arrive later, and the ID is only a record label.
  10. Fit on training rows only; apply that scaler to both sets · Training rows choose the scaler's values. Reusing that scaler on test rows keeps the test data from choosing the transformation.
Worksheet · LightMySky