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 cereal table lists name, calories, sugars, fiber, and rating per cereal. To predict rating, what does one row hold?

    • One cereal with its measured values
    • One nutrient measured across all cereals
    • One shopper with a cart
  2. You want to predict whether a person buys popcorn at the cinema. Your raw logs list each ticket sale with the buyer's age, the snack bought, and the show time. What should one row of your training table represent?

    • One visit by one person, with a yes or no for popcorn
    • One bag of popcorn sold
    • One full day of ticket sales
    • One seat in the theater
  3. A breakfast dataset has one line per cereal with columns: name, calories, sugars, fiber, rating. The goal is to predict rating from the other values. What does one row of this data hold?

    • One breakfast cereal and its measured values
    • One nutrient measured across all cereals
    • One rating number by itself
    • One shopper and their cart
  4. A shop grid has one row per customer with columns age, visits, spend. What sits in row 4, column 2?

    • The age of the fourth customer
    • The visit count of the fourth customer
    • The total number of customers
  5. A dataset has a column weight_kg and also a column weight_g holding the same weights in grams. Keeping both columns gives the model new information it could not get from weight_kg alone.

    Circle one:   True   False

  6. Logs list each ticket sale with age, snack, and show time. To predict popcorn buys, what should one row represent?

    • One visit by one person, with a yes or no for popcorn
    • One full day of ticket sales
    • One seat in the theater
  7. A table of houses has columns: rooms, area, price, and neighborhood, where neighborhood is text like "Riverside" or "Hilltop". The model can only multiply and add numbers. What must be done to the neighborhood column before the table becomes a feature matrix?

    • Replace each neighborhood with a numeric code, such as a 0 or 1 flag per neighborhood
    • Leave the words as they are because models can read
    • Delete every row that contains a word
    • Convert the number columns into words so all columns match
  8. A distance model sees income from 0 to 200000 and schooling from 0 to 10, used raw. Which feature dominates the distance, and why?

    • Schooling, because years matter more than money
    • Income, because its raw gaps dwarf the year gaps
    • Both equally, because there are two columns
  9. A patient table holds ID, measurements, N_Days, Status, and Drug, and the goal is to predict Status. Which columns enter the feature matrix?

    • All columns, including ID and Status
    • Only ID and Drug, since they name the patient
    • Only the measured features, with Status apart as the target
  10. Jo trains a distance model on raw income and schooling years and trusts the distances. What is wrong?

    • Income gaps swamp schooling gaps, so the columns need rescaling first
    • Years must be turned into words first
    • Nothing, raw numbers are always fair
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 cereal with its measured values · The rating belongs to one cereal, so each row must carry one cereal with all its values.
  2. One visit by one person, with a yes or no for popcorn · The prediction target is a single yes or no about popcorn for a person at a showing. A row must be the unit you can attach that target to, which is one person's visit.
  3. One breakfast cereal and its measured values · To predict rating for each cereal, every row must be a single cereal carrying all its feature values plus its rating.
  4. The visit count of the fourth customer · Rows pick the example and columns pick the feature, landing on visits for customer four.
  5. False · Grams are just kilograms times 1000, so the second column is a fixed multiple of the first. The two columns always move together and carry the same information.
  6. One visit by one person, with a yes or no for popcorn · The target is one yes or no per visit, so the row must be one person visit.
  7. Replace each neighborhood with a numeric code, such as a 0 or 1 flag per neighborhood · A feature matrix must be numeric. Text categories are encoded, for example with a 0 or 1 flag for each possible neighborhood, so no words remain.
  8. Income, because its raw gaps dwarf the year gaps · Raw gaps in income run to thousands while schooling gaps stay tiny, so income decides every distance.
  9. Only the measured features, with Status apart as the target · IDs name but measure nothing, Status is the answer, and Drug comes after diagnosis.
  10. Income gaps swamp schooling gaps, so the columns need rescaling first · Without comparable ranges, income alone decides every distance.
Worksheet · LightMySky