Unit 2.1 · about 2 h
5 / 324Frame a prediction task and choose a baseline
A model can optimize the wrong target very effectively. Starting with the decision, target, available information and success metric prevents an attractive score from substituting for a useful result.
- explain
- derive
You can now
- State a non-ML product or operational goal before naming an algorithm.
- Identify one observation, the target
cntand the permitted predictor features. - Explain why the task is regression and choose a metric whose units match the decision.
- Define a simple baseline that any trained estimator must beat.
- Define the prediction moment as the start of the hour and distinguish calendar inputs known then from observed weather and demand fields that are not yet available.
Covers
- Prediction tasks, targets and success metrics
- Prediction-time feature availability
Study, in this order
2 steps
- Introduction to Machine Learning Problem FramingIntroduction to Machine Learning Problem Framing
Complete the course objectives on ML suitability, problem framing, model output and success metrics.
- Bike Sharing DatasetBike Sharing Dataset
Read the dataset description and variable table.
cntis the target;casualandregisteredare other variables that compose the target.
Focus on
- Goal, observation, feature, target and prediction time
- Regression output and MAE as an interpretable metric
- A naive baseline before a sophisticated estimator
- The distinction between a product metric and a model metric
- Prediction moment: at the start of the hour, before its rentals and observed weather are known
Reproduce closed-book
Traps
- Do not assume ML is necessary when a rule or existing forecast would be better.
- Do not include values that are only known after the prediction time.
- Do not select a metric because it is familiar; justify its relation to the task.
Practice
Complete the short course and write the goal, model output and success metric for one additional example.
Use the exercise to distinguish predictive ML from generative AI and non-ML approaches.
Self-test
-
Why is
cnta regression target in the bike-sharing project?It is the numeric count of rental bikes for an hour, so the model predicts a continuous-valued count rather than a class label. -
What is a baseline and why should it be measured first?
A simple, transparent predictor such as the training-set mean establishes a minimum reference. A complex model is not useful unless it improves on that reference under the same evaluation protocol.
Completion criterion
Stop when
You can state the product goal, target, prediction moment, allowed calendar inputs, excluded observed fields, regression metric and a simple baseline without referring to a model library.
Mark passed, then open 2.2 Only mark this when you can do it without notes.Leads to
- 2.2 Split data by time and prevent leakage Follow the practical starter sequence; each unit uses the artifact from the previous step.
Comes after
- 1.4 Visualize a dataset and write a data auditFollow the practical starter sequence; each unit uses the artifact from the previous step.
Resources for this unit
- Bike Sharing Dataset Use the hourly dataset (17,389 records) for a first regression project. Sort chronologically; use 2011 for training and 2012 as the untouched final test period.
cntis the target. Excludecasual,registered,cnt,instant,dtedayandyrfrom the model feature matrix; usedtedayonly to sort/split. - Introduction to Machine Learning Problem Framing Complete the short course on deciding whether ML fits the problem, framing the model output and choosing success metrics before touching the estimator.
Also in this section
- Kaggle Learn — Intro to Machine Learning Complete the lessons on how models work, data exploration, the first model, model validation, underfitting/overfitting and random forests. Reproduce the exercises in a fresh notebook.
- Google Machine Learning Crash Course Use the modules on regression, numerical and categorical data, datasets/generalization/overfitting, and classification metrics as a structured conceptual companion. The course is free and includes interactive exercises.
- Pipelines and composite estimators Study
PipelineandColumnTransformer. Keep preprocessing inside the pipeline so transformations are fitted only on the training partition and applied consistently at evaluation time. - Common pitfalls and recommended practices Read the sections on inconsistent preprocessing and data leakage. Use the wrong/right examples to audit the project before trusting the reported test score.
- TimeSeriesSplit Read why ordinary cross-validation can train on future observations and evaluate on the past. The starter project uses one chronological year holdout; use TimeSeriesSplit when extending it to repeated time-aware validation.
- Model evaluation: regression metrics Use the regression metric definitions for MAE, MSE/RMSE and R-squared. Explain the units and limitations of each metric instead of reporting a score without context.
- Machine Learning in Python with scikit-learn (MOOC) Use as the free, more thorough follow-on after this guided first model. Its static course and notebooks are openly available; the materials are published under CC BY.
- Model persistence Read the security and version-compatibility warnings before saving an estimator. Treat the training code, package versions, data split and metrics as the reproducible artifact, not just a serialized model file.