Skip to content
AI.info

How machines learn

Examples, Observations, and the Unit of Experience

Learn how raw events become training examples and why identity, time, grouping, and repeated observations change what a dataset means.

By the end you can

Visual

Data records are assembled, not discovered ready-made

Operational systems store events for billing, logging, support, and compliance. A training example is a deliberate construction. It combines selected information around a prediction unit and time.

The Human Activity Recognition dataset this lesson comes back to twice has every step of that construction on the record. Thirty volunteers aged 19 to 48 each wore a waist-mounted Samsung Galaxy S II. The phone sampled its accelerometer and gyroscope at 50 Hz. The signals were median- and Butterworth-filtered, and then cut. “The time signals were then sampled in fixed-width sliding windows of 2.56 sec and 50% overlap between them”, says the 2013 paper that released the data. Each window was summarised into 561 features. The output is 10,299 records — what Saeb and colleagues, using the same dataset, describe as “an average of 343 records per subject”. On that dataset the multiclass SVM reached “an overall accuracy of 96% for the test data composed of 2947 patterns”.

Read the pipeline backwards and the point is hard to miss. Not one of those 10,299 rows was an event the phone recorded. Every one of them is a decision: this sampling rate, this filter, this window length, this overlap, these 561 numbers. And because consecutive windows overlap by 50%, adjacent rows literally share half of the raw signal underneath them.

FigureProcess · 5 steps
  1. 1

    Raw events

    Clicks, scans, payments, messages, sensor readings, and edits arrive for operational reasons.

  2. 2

    Entity resolution

    Records are connected to users, orders, devices, sessions, or cases.

  3. 3

    Observation window

    A cutoff determines which events count as available evidence.

  4. 4

    Feature record

    Events are summarized or encoded into a representation for one prediction.

  5. 5

    Outcome record

    A later event or review supplies the target when it becomes observable.

Example

The same history can produce several valid examples

One history can be cut into examples several valid ways, and someone chooses which. Netflix made that choice in public and wrote down the reason. Its own 2007 paper describes the release: “over 100 million ratings (and their dates) from over 480 thousand randomly-chosen, anonymous subscribers on nearly 18 thousand movie titles”, collected between October 1998 and December 2005. Those subscribers had years of viewing history apiece — 209 rows per subscriber on average. What went into a row, and where the held-out set was cut, were two separate decisions. Neither was the default.

  • The unit chosen: one user-item pair, a single subscriber's rating of a single movie. The winning team reports the exact sizes — 100,480,507 ratings on 17,770 movies from 480,189 users.
  • The cutoff chosen: not a random slice of rows but a per-user time boundary. “the user's 9 most recent ratings were selected to assign to the subsets”, halved for users with fewer than 18 ratings.
  • The reason given, in one sentence: “Selecting the most recent ratings reflects the Netflix business goal of predicting future ratings based on past ratings.” — Bennett and Lanning, Netflix, 2007.
  • What that cutoff produced: a probe set of 1,408,395 ratings and a qualifying set of 2,817,131, each held out by time within each subscriber rather than by shuffling.
  • The units the same events could have produced instead: one subscriber-level example (will this account cancel within the next 30 days), one session-level example (will this session end without playing anything), one day-level example (minutes watched tomorrow), one event-sequence example (the next action, from the ordered history of searches, previews, and plays). Same activity, different rows, different task.

Repeated rows from one entity are related

If one patient contributes ten visits, one machine contributes hourly readings, or one user creates thousands of clicks, those rows are not independent in the ordinary sense. They share identity, environment, history, and often near-duplicate information.

How much identity does a handful of rows carry? Netflix released the Prize data on 2 October 2006 with names replaced by numbers. Narayanan and Shmatikov then measured what was left in it. With 8 movie ratings, of which 2 may be completely wrong, and dates that may have a 14-day error, 99% of records are uniquely identified in the dataset. Two ratings with dates accurate to 3 days pin down 68%. The identifier column had been removed. The rows were still the identifier.

On 12 March 2010 the FTC closed its inquiry into that release. Maneesha Mithal, of its Division of Privacy and Identity Protection, wrote the closing letter. Netflix had agreed to suspend the planned Prize 2 release and, if it ever released such data again, to do so only to researchers under contractual limits. The letter records what had already gone out: “The Prize 1 data set represented the movies rated by over 480,000 Netflix customers and the date each rating was given.”

A model does not need an identifier column either, and the leak has a name and a number. A 2019 paper in npj Digital Medicine calls it identity confounding: with a record-wise split, “the relationship between feature data and disease labels learned by the classifier is confounded by the identity of the subjects”. Its authors ran a permutation test on Parkinson's voice recordings from 22 participants in the mPower study. Shuffle the disease labels until nothing but identity survives, then see what a classifier still scores: “The identity confounding issue was particularly strong for the classifier built from the voice data collected from a subset of 22 participants from the mPower study (Fig. 2c) where the permutation null distribution (which captures the identity confounding) was centered at a 0.95 AUC score.” A model that could not possibly have been detecting disease still scored 0.95. It was recognising who was speaking.

This matters when splitting data and interpreting metrics. Randomly placing records from the same entity in training and test sets can make the task easier than deployment, especially when the model can recognize the entity indirectly — and 0.95 is how easy that recognition can be.

More rows do not necessarily mean more independent experience.

Case

Record-wise or subject-wise: 2% error or 27%, same rows

Splitting one set of rows two different ways moves the error rate from 2% to 27%. Saeb and colleagues measured that in 2017, in GigaScience, on the Human Activity Recognition dataset — the same 10,299 windows from 30 volunteers. Splitting it record-wise puts rows from the same person on both sides of the split. The classification error then sat at 2% with data from only two subjects. In their words, it “did not significantly change” as more subjects were added. Splitting subject-wise, no test subject appeared in training. The error “started at a value of 27% and, as the number of subjects increased to 30, it decreased significantly and reached 9%”. The rows were identical. The split decided what the number meant. The same paper reviewed published clinical machine-learning studies. It found 28 of 62 — about 45% — had reported record-wise figures for models intended to diagnose new patients.

Cardiology has been building against the same hazard for longer, and shows how hard the clean version is. The MIT-BIH Arrhythmia Database holds “48 half-hour excerpts of two-channel ambulatory ECG recordings, obtained from 47 subjects” with “approximately 110,000 annotations in all”. That is roughly 2,340 rows per person. In 2004 de Chazal and colleagues built the standard patient-independent protocol out of it: “The data was split into two datasets with each dataset containing approximately 50,000 beats from 22 recordings”. DS1 holds 51,021 beats for training and DS2 holds 49,712 for testing — 100,733 beats in total from 44 non-pacemaker records, deliberately divided so that a patient falls on one side only. Deliberately, and still not quite. A later systematic review notes: “Notably, records 201 and 202, originating from the same patient, are placed in different datasets, while all other records pertain to unique patients.” One patient in forty-four straddles the split of the protocol built expressly to stop that happening.

Figure

The same rows, split two ways: the number a record-wise split reports never moves, and the number a subject-wise split reports is the one that responds to more people.

Comparison

Observation window, gap, and outcome horizon

Time-based examples need three separate intervals. Combining them carelessly is a common source of leakage and mislabeled cases.

Outcome horizons are often fixed by policy rather than discovered in the data. Medicare’s Hospital Readmissions Reduction Program was created under the Affordable Care Act. It is set out in section 1886(q) of the Social Security Act. It counts “unplanned readmissions that happen within 30 days of discharge from the index (that is, initial) admission”. CMS began reducing payments to hospitals with excess readmissions for discharges from 1 October 2012. The reduction is “capped at 3 percent (that is, a payment adjustment factor of 0.97)” of a hospital’s Medicare inpatient payments. Six conditions and procedures are counted. They are heart attack, chronic obstructive pulmonary disease, heart failure, pneumonia, coronary artery bypass graft surgery, and elective hip or knee replacement. Nothing in a patient’s chart says thirty days. The statute does not say it either. It defines a readmission as one occurring “within a time period specified by the Secretary”, and offers thirty only as an example. The number is an administrative choice made downstream of the law. Every model built to anticipate that penalty inherits it along with the penalty.

Healthcare is not a special case, and the pattern is not confined to one country's statute book. Banking supervisors fix the outcome clock for credit risk the same way. The Basel Framework's minimum requirements for the IRB approach say a default has occurred when the bank judges the obligor unlikely to pay, or when “The obligor is past due more than 90 days on any material credit obligation to the banking group”. A footnote then admits outright that the threshold is somebody's choice rather than a property of borrowers: “In the case of retail and public sector entity (PSE) obligations, for the 90 days figure, a supervisor may substitute a figure up to 180 days for different products, as it considers appropriate to local conditions.” The EU wrote the same rule into Article 178(1)(b) of Regulation (EU) No 575/2013, carrying the same 90-to-180-day discretion for exposures secured by residential property. The European Banking Authority then spent 29 pages, in 2017, specifying how to count the days — down to the rule that where a law suspends repayment “the counting of days past due should also be suspended during that period”. A model that predicts default predicts a label three bodies defined, on a clock a fourth document says when to stop.

Where no regulator sets the horizon, someone still sets it, and the defensible practice is to say why in writing. Netflix's held-out set, above, is that practice: a per-user time cutoff, adopted because the deployed system had to predict future ratings from past ones, and stated as such in the paper that released the data.

FigureComparison · 3 columns

Observation window

The period whose information becomes model input.

  • Ends at the prediction time
  • May summarize minutes, days, or months
  • Must match live data availability
  • Example: purchases in the previous 90 days

Gap or buffer

A period intentionally excluded between evidence and outcome.

  • Prevents late-arriving or anticipatory signals
  • Reflects action and processing delay
  • May be zero for some tasks
  • Example: ignore activity during the next 24 hours

Outcome horizon

The future period in which the target is measured.

  • Defines what “positive” means
  • Controls how quickly labels arrive
  • Changes the business interpretation
  • Example: cancellation within 30 days

Key idea

Independence is an assumption, not a property of CSV files

Many learning methods and evaluation procedures are easiest to reason about when examples are treated as drawn from a common distribution, yet real datasets contain households, stores, devices, geographic clusters, time trends, and repeated measurements.

Every dataset in this lesson has two counts, and they are far apart. The Human Activity Recognition data is 10,299 rows and 30 people. MIT-BIH is roughly 110,000 annotations and 47 subjects. The Netflix Prize release is 100,480,507 ratings and 480,189 subscribers. In each case the second number is the one that varies independently. In each case the first is the one that gets reported.

The answer is not to pretend dependence disappears. Document the grouping structure, choose splits that reflect deployment, and report uncertainty with awareness of the true unit that varies.

The entity that varies independently may be a customer or machine, not the individual row.

Position

The default split is not the neutral one

Shuffling the rows and slicing off a test set feels like the option that adds no assumption. It adds a large one. It assumes the entities in the test set are entities the model has already trained on. For any system that will meet a person, a machine or an account it has never seen, that assumption is false. The number it produces is not merely optimistic. It is an answer to a different question.

The size of the difference is not a matter of argument. Record-wise, the error was 2% with data from two subjects. It did not significantly change as more were added. Subject-wise, it began at 27% and reached 9% by thirty subjects. Optimism is the smaller of the two problems on display. The record-wise measurement did not move when the dataset gained more people. That was the one thing genuinely improving the model. So it could not have told the team whether recruiting more of them was worth the money. A number that cannot respond to your only real lever is not a weak measurement of that question. It is not a measurement of it.

That the split unit belongs in writing is not an abstract counsel of tidiness. Look at what happens without it, on the very dataset Saeb's team used. The 2013 paper describes its own partition this way: “In order to ease the performance assessment, the dataset has been also randomly partitioned into two independent sets, where 70% of the data were selected for training and the remaining 30% for testing.” The UCI Machine Learning Repository record for the identical 10,299 rows describes it as “70% of the volunteers was selected for generating the training data and 30% the test data”. The first sentence is a record-wise split. The second is a subject-wise split. They are two authoritative descriptions of one partition of one benchmark. On this dataset the distance between them is the distance between 2% and 27% error. Anyone downloading the benchmark cannot tell from its documentation which of the two numbers they are about to reproduce.

None of which forbids a random split. The split unit is a claim about who the model will meet as a stranger. It belongs in writing next to the claim it supports. A system that will serve the same fifty machines for its whole life can defend a record-wise split. A diagnostic aimed at patients nobody has seen cannot. What no design defends is arriving at either by leaving an argument at its default — and the default is winning. Among the studies Saeb's team reviewed, 28 of 62 reported record-wise figures for models meant to diagnose new patients. Cardiology gives the same shape of answer from a different field. A systematic review of 122 ECG classification papers published 2017-2024 found only “37 articles (30.3%) adhered to the inter-patient paradigm”. About seven in ten still put the same patient's beats on both sides.

A random split quietly assumes the model will only ever meet people it has already met.

Analogy

An analogy: exam questions from the same worksheet

A student practices with five worksheets. They reuse the same numbers and sentence patterns, so a test assembled by randomly selecting questions from those worksheets may look new while remaining highly familiar.

The Human Activity Recognition windows are the literal version of that worksheet, with the overlap stated in the paper. Consecutive rows are 2.56-second windows sliding by half a window, so a row and its neighbour are built from half the same raw signal. Nothing needs to be reused by accident. The construction guarantees it.

Repeated observations of one entity create a similar risk: surface-level rows differ, but shared identity makes the test easier. Real dependence has more sources than a shared worksheet. Time, location, policy, and network relationships all create it.

Steps

Review a proposed example before training

A ten-minute review can reveal mismatches that later appear as mysterious model failures. Name the row, trace its sources, mark the cutoff, identify its relatives, and confirm that live inference can build the same record.

Run those five questions against a dataset whose construction is documented and the answers are short. In the Human Activity Recognition data, one example is one 2.56-second window of filtered accelerometer and gyroscope signal from one volunteer, summarised into 561 features. Its sources are a 50 Hz sensor stream and a filtering-and-windowing pipeline. Its relatives are the adjacent windows sharing half their raw signal, and the 343 windows a subject contributes on average. In the Netflix Prize data, one example is one subscriber's rating of one movie. The cutoff was placed per user, at that subscriber's 9 most recent ratings, not per row. Its relatives are the 209 ratings the average subscriber contributed. Neither review takes long. Both of them change the split before anything is trained.

FigureProcess · 5 steps
  1. 1. Name the row

    Finish the sentence: one example represents one…

  2. 2. Trace its sources

    List every table, event stream, annotation, and join used to construct it.

  3. 3. Mark the cutoff

    State when the prediction occurs and exclude later evidence.

  4. 4. Identify relatives

    Record shared users, devices, households, sessions, or time blocks.

  5. 5. Match deployment

    Confirm that live inference can construct the same kind of record.

Beware of examples created by aggressive windowing

Sliding windows can turn one long sequence into thousands of examples. This may help training. It also creates overlapping records whose features and targets share much of the same underlying data.

The Human Activity Recognition dataset shows the multiplication with both numbers printed. Thirty volunteers, one waist-mounted phone each, and 10,299 rows: an average of 343 records per subject, with each row sharing half its raw signal with the row beside it. MIT-BIH multiplies harder still — 47 subjects, roughly 110,000 annotations, about 2,340 rows per person. Neither dataset is small. Both have a sample size in the dozens.

Count both rows and distinct entities, episodes, or time periods, because a dataset with one million windows from fifty machines is a very different evidence base from one million windows from fifty thousand machines.

Key takeaways