Unit 1 of 8 · about 3 hours · explain

Unit of observation, prediction time and label horizon

Every later choice inherits the prediction context. A row is not a prediction; the contract that binds a row to a decision time is.

You'll be able to

  • State the unit of observation, the population, and the prediction context for a new problem in one short paragraph.
  • Specify prediction time, feature cutoff, action time, label horizon, and label availability for an hourly bike-demand task.
  • Explain why hour.csv and day.csv define different prediction contexts even though they describe the same system.

Covers

Unit of observation, population and prediction contextPrediction time, feature cutoff, action time and label horizon
1

Read

In this order, only the parts listed

0 of 4 done

  1. ML project checklist: framing and data captureHands-On Machine Learning with Scikit-Learn and PyTorch - Chapters 1 and 2

    Frame the problem and look at the big picture, items 1 to 12; Get the data, items 1 to 11, including item 11 on sampling a test set aside and never looking at it

    Read as a checklist, not a textbook. Skip the Launch section here; it returns in the lineage unit.

  2. Housing task statement as a prediction-context exampleHands-On Machine Learning with Scikit-Learn and PyTorch - Chapters 1 and 2

    Book Chapter 2: Frame the Problem (printed pp. 43-45). Notebook 02: Get the Data: the Housing Corp task statement, predicting median house values in Californian districts, where the unit of observation is one district

  3. Instances, examples, and freshness requirementsRules of Machine Learning - first controls

    Terminology: Instance, Label, Feature, Feature Column, Example; Rule 8: Know the freshness requirements of your system, with the Play Search and Whats Hot staleness examples

  4. Bike Sharing data dictionary and filesUCI Bike Sharing Dataset

    Variables Table and Additional Variable Information: instant, dteday, hr, casual, registered, cnt, including the note that hr is absent from day.csv; Dataset Files: hour.csv, day.csv, Readme.txt; Dataset Characteristics with the no-missing-values statement

2

Focus on

  • The unit of observation is the row the decision attaches to: one district in housing, one system-hour in hour.csv, one system-day in day.csv. The two bike files are different populations of prediction contexts, not two views of one table.
  • Prediction time fixes which fields may be used. Anything recorded after the cutoff is unavailable even when it sits in the same CSV row: the horizon outcome itself, and also the weather observed during the hour. At the top of the hour a live system has only a forecast, so using hour.csv weather is an oracle-forecast assumption the contract must declare.
  • Freshness is part of the context. State how old a model or feature may be before quality loss forces action, using Rule 8: Play Search degrades in under a month without updates, while identifier-free Whats Hot models export infrequently.
  • Checklist items 1 to 12 plus Get-the-data item 11 are the contract skeleton: objective, usage, current workaround, framing, measure, alignment, minimum performance, assumptions, and one untouched test set.
Common mistakes · 3
  • Treating each CSV row as a prediction without naming the decision time. hour.csv and day.csv can describe the same period at different grains and need different horizons and actions.
  • Reading dteday as a ready timestamp. In hour.csv it is a date string plus a separate hr column; the prediction instant is their combination, and parsing it is part of the contract.
  • Quoting the landing page count as the file count. The page states 17389 instances while the downloadable hour.csv holds 17379 data rows by direct count; count the file you downloaded and record the date.
3

Try it yourself

Closed-book, before checking anything

Closed-book, write the one-paragraph contract for hourly bike demand: unit (one system-hour), population (dated hours in hour.csv), prediction time (top of the hour, before that hour rentals are known), cutoff (fields timestamped at or before prediction time only), horizon (the coming hour cnt), and action (fleet rebalancing). State why day.csv needs a separate contract.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.In the Housing Corp task, what is the unit of observation?Answer

    One Californian district, which is one row of the housing data. The model predicts one median house value per district.

  2. 2.Why do hour.csv and day.csv need separate prediction contracts?Answer

    Different units (hour versus day), different horizons (next-hour versus next-day cnt), and different availability: hr exists only in hour.csv, and an hourly rebalancing action cannot wait for the day aggregate.

  3. 3.A bike feature table refreshes daily but predictions run hourly. What must the contract state?Answer

    The feature cutoff and the freshness requirement: hourly predictions reuse the last daily value, with a stated maximum age and a staleness check in the style of Rule 8.

  4. 4.Where does the label horizon sit relative to prediction time in the bike contract?Answer

    After it: cnt over the coming hour is realized after prediction time. The same-hour casual and registered counts are label parts, not features.

You're done when

You can write the hourly bike contract from memory, including why day.csv is excluded and which columns are unavailable at prediction time.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 3 more in the section
  • Hands-On Machine Learning with Scikit-Learn and PyTorch - Chapters 1 and 2Aurelien Geron (O'Reilly, 2025) · primary

    Read Chapters 1 and 2 of the book, then run notebooks 01 and 02 and use ml-project-checklist.md for framing, data inspection, test-set creation, preprocessing pipelines, cross-validation, error analysis and persistence. Rebuild the workflow on UCI Bike Sharing with a chronological split and prohibit casual and registered when predicting cnt.

  • Rules of Machine Learning - first controlsGoogle for Developers · support

    Read Rules 1-5 and 8-9. Turn the existing heuristic into a baseline and test the feature path independently of the learner.

  • UCI Bike Sharing DatasetUCI Machine Learning Repository · support

    Use hour.csv as the compact integrated dataset. Preserve a raw snapshot and data dictionary, split chronologically, and document why casual and registered are target proxies for cnt.

Also in this section

  • scikit-learn - Common pitfalls and pipelinesscikit-learn · required

    Read Common Pitfalls sections on inconsistent preprocessing and leakage, then Pipeline and ColumnTransformer. Seed global scaling, a target-derived feature and a partition duplicate, and make tests reject each defect.

  • scikit-learn - Cross-validation splittersscikit-learn · support

    Use the group-aware and time-aware splitter sections plus GroupKFold and TimeSeriesSplit. Choose from the dependence structure and assert that no prohibited group or future timestamp crosses the boundary.

  • Google ML Problem Framing - framing an ML problemGoogle for Developers · support

    Read Identify the output you need through Proxy labels and Define the success metrics, including the video-caching threshold analysis, the proxy-issue table, and both Check Your Understanding boxes.