Learning outcomes
After studying this lesson, you will be able to:
- Identify the entity and unit of observation in tabular data.
- Distinguish features X, target y, and identifiers.
- Explain regression and classification through the type of target.
- Check whether features are available at prediction time.
1. Entity and unit of observation
An entity is what we want to reason about: a building, customer, product, trip, or event. The unit of observation is the specific record used for analysis. One entity can produce many observations; a building, for example, may be measured every hour.
Before building a table, complete the sentence: “One row describes …”. If the answer is ambiguous, the data structure and evaluation design are not yet defined.
2. Features and the matrix X
A feature is an input variable describing an entity and available to the model when it makes a prediction. The feature matrix is denoted X: rows are observations and columns are features. Examples include outdoor temperature, floor area, day of week, and planned occupancy.
An entity identifier is often needed to join records and create group splits, but it is not necessarily a useful predictor. A unique building ID may let a model memorize a particular site rather than learn a pattern that transfers to new buildings.
3. The target variable y
The target is the quantity or category the model is expected to predict. In a labelled training set, known target values provide the reference answers. In common notation, X contains inputs and y contains outcomes.
Define the target precisely: what is measured, in which units, over what horizon, and for which entity. “Forecast energy use” is incomplete without specifying the period and measurement boundary.
4. Regression and classification
When the target is a quantitative value, the task is usually regression: predicting kWh, delivery time, or temperature. When the target is a category, it is classification: fault/normal, request type, or risk class.
Numbers used as category codes do not turn a task into regression. Codes 0, 1, and 2 may represent three classes without meaningful numeric distances between them.
5. Features must exist at prediction time
For every feature, ask: “Will this value be known when the system must produce its prediction?” For tomorrow’s load forecast, today’s temperature and a known calendar may be available, but tomorrow’s actual consumption is not.
A feature that contains the answer or becomes available only after the event creates target leakage. A large metric improvement does not make such an input legitimate.
6. Practice: annotate a table
Task: forecast a building’s daily energy consumption. Candidate fields are date, building ID, outdoor temperature, floor area, planned occupancy, actual occupancy, and measured energy consumption.
Identify the entity and row; choose X and y; mark the identifier; then divide features into those available before the day starts and those recorded afterwards. Explain why actual consumption cannot be an input for forecasting that same period.