Limitations of Machine Learning Models
Many machine learning projects are motivated by a wish to stop writing rules by hand.
A Travel Agency Predicting Flight Prices
Imagine you work at a travel agency and have been asked to predict what a flight will cost. You already have a useful archive. Every past flight has a price, a date, an airline, a departure city, and a destination. A learning algorithm can take that table and find real relationships in it. This article asks what you should do when the table is not enough, because some of the forces that move prices never appear in the table at all.
Many machine learning projects are motivated by a wish to stop writing rules by hand. Instead of a person deciding in advance that a certain airline is expensive or that a certain route is cheap, the model is expected to discover such relationships from data. Given that goal, it is tempting to think that prior knowledge about the application should be thrown away. The source pushes back on that temptation. Discarding prior knowledge is not required. The answer is not to abandon what you know about travel. Expert knowledge can be turned into new columns, called features, that give the model information it could not otherwise reach.
Tracing a Raw Flight Record
Start with one row of the archive. This raw record is the representation the model receives by default. Each column becomes an input, and the price is the target the model must predict. Follow what the model can see as it moves from the raw record toward a prediction.
| Column | Role for the model | What it tells the model |
|---|---|---|
| Price | Target | The value to predict |
| Date | Input | The calendar day of the flight |
| Airline | Input | Which carrier operates the flight |
| Departure city | Input | Where the flight starts |
| Destination | Input | Where the flight goes |
The raw record for one past flight, using only the columns in the archive
The raw record carries the date, but it does not say anything about holidays. The expert rule supplies that missing relation. Once the relation is stored as a column, the model receives the holiday knowledge as an ordinary input, in the same way it receives the airline or the route.
Why a Raw Date Falls Short
The flight price example makes the limitation concrete. Flights are usually more expensive during peak vacation months and around holidays. A model that only sees a date can pick up on seasonal patterns that show up in the data. But holidays do not all behave the same way with respect to the calendar, and this is where the raw date starts to fail.
Three kinds of holiday are worth separating. Some holidays fall on a fixed date, such as Christmas, so their effect on prices can be learned directly from the date. Other holidays depend on the phases of the moon, such as Hanukkah and Easter, so the same calendar date does not always mark the same event. A third group is set by authorities, such as school holidays, whose timing is a policy decision rather than an astronomical or calendar rule.
The consequence is direct. A model that stores only Gregorian dates does not contain the information behind moon-dependent or authority-set holidays. The effect of those holidays cannot be read off a date alone, because the date does not determine the event.
What do you think happens?
A flight departs the day before a school holiday. Which value should the holiday relation feature record?
Reveal answer
preceding
The holiday feature has three situations: the flight falls on a holiday, comes before one, or comes after one. A flight that departs the day before a holiday comes before it, so it is recorded as preceding.
Adding a Holiday Relation Feature
The fix the source describes is simple to state. Add a feature that records how a flight relates to a public or school holiday. The new feature takes one of three values: the flight falls on a holiday, the flight comes before one, or the flight comes after one. The model and the target price stay exactly the same. Only the input representation changes.
The left column shows what a model sees when only the raw columns are used. The right column keeps those same columns and adds one expert-derived feature. Nothing about the algorithm or the target has changed. The only difference is that the right-hand input carries knowledge about the holiday structure of the task, which the raw date alone could not express.
Why a Domain Feature Is Low Risk
Adding a candidate feature gives the algorithm an option, not an obligation. An added feature does not force the algorithm to use it, and an uninformative feature does not hurt. This asymmetry is why domain-driven features are worth trying even when you are unsure whether they will help.
The cost of a weak guess is usually small, while the benefit of a good one can be large, because it may expose a pattern the raw record could never reveal. The strategy is therefore to propose candidate features from what experts know, add them, and let the model decide whether they carry signal.
Scoring a Competition Entry
Consider a simple competition in which entries are ranked by accuracy, the fraction of predictions that match the true labels. The code below is a small, illustrative version of that scoring rule. It is written for this article and is not taken from the source.
0.8y_trueholds the true labels from the prepared datasety_predholds the labels the entry predicted- The loop counts the positions where the prediction matches the truth
- Dividing by the number of predictions gives the leaderboard score
The output 0.8 means four of the five predictions match. That single number is what the leaderboard ranks. Notice what the code does not contain: it does not say whether accuracy is the right thing to measure for the real situation, or whether the five labels represent the flights a travel agency actually cares about.
What a Competition Hands You in Advance
Machine learning competitions are an exciting way to test your skills. You download a dataset, train a model, submit predictions, and watch your name climb a leaderboard. Two decisions are made for you before you start. The first is the target: the competition supplies a particular metric to optimize, so your job becomes improving a number that someone else selected. The second is the data: you usually receive a fixed dataset that has already been preprocessed. Its contents, its format, and the way it was prepared are all settled before you open the files.
These two givens make competitions clean and comparable. Everyone is measured on the same number using the same data, which is exactly what a fair contest needs. The same givens also mean that the skills a competition rewards are narrower than the full set of skills a real project demands.
Why the Leaderboard Is Not the Whole Story
A strong leaderboard result measures performance on the competition's chosen metric and data, which may differ from the real-world goal. The misconception to watch for is this: if a model ranks first in a competition, it is the best possible answer to the underlying real-world question. That belief quietly assumes that someone has already done the hardest parts of the job. A leaderboard only compares entries against one scoring rule and one prepared dataset. Whether that rule and dataset are the right ones for the actual situation is a separate question, and the leaderboard does not answer it.
In real work, defining the problem and collecting the data are important aspects of the task. Before a model can be trained, someone must decide what the model is supposed to predict, for whom, and what outcome would count as success. Someone must also gather the information that will feed the model. Neither step is handled by a competition, so a real project starts with questions a competition never asks.
Mistakes Learners Make with Limitations
Common mistake Assuming the model will find a holiday effect that the stored columns do not contain
What it looks likeA model trained only on Gregorian dates is expected to predict a moon-dependent holiday surge.
Why it failsA date alone does not determine a moon-dependent event, so the information behind the effect is absent from the input.
Do this insteadAdd a feature that encodes the holiday relation, such as on, preceding, or following.
Common mistake Throwing away expert knowledge because the goal is to avoid hand-written rules
Why it failsThe source states that discarding prior knowledge is not required and that experts can point to more informative features than the raw representation.
Do this insteadTurn what experts know into candidate features and let the model decide whether they help.
Common mistake Treating a first place on the leaderboard as the answer to the real-world question
What it looks likeAn entry tops a leaderboard scored on accuracy, and the team stops asking what the business actually needs.
Why it failsA leaderboard only compares entries against one metric and one prepared dataset.
Do this insteadCheck whether the metric and dataset match the real goal, and define the problem and collect the data yourself.
Common mistake Believing an unhelpful feature will damage the model, which discourages trying candidate features
Practicing Feature Design
You are predicting flight prices for a travel agency. Your archive stores only the Gregorian departure date, airline, and route. Propose one domain-driven feature that could expose a pattern the raw date cannot reveal, and state what values it can take. Then explain why adding it is low risk even if it turns out to be uninformative.
Hints
- Think about which holidays were listed in the source: fixed-date, moon-dependent, and authority-set.
- The source describes a relation feature with three possible situations.
- Remember that an added feature gives the algorithm an option, not an obligation.
Practice Resources on Kaggle and OpenML
Competitions are still valuable, and the same platforms that host them are rich sources of material for practice. The Kaggle forums are a good place to learn about the latest tools and techniques in machine learning, and a wide range of datasets is available on the site. The OpenML platform offers even more: it hosts over 20,000 datasets with over 50,000 associated machine learning tasks.
When you practice on these tasks, ask the framing questions from this article: what is the real goal, what does the metric measure, and what information is missing from the table. Treating each task as a fixed, finished problem skips the parts of the work a competition does not teach.
Key Takeaways
- Expert knowledge still matters: domain experts can point to features that are more informative than the raw representation of the data.
- A model cannot learn an effect from a record that does not contain the information behind it, such as moon-dependent or authority-set holidays stored only as Gregorian dates.
- A holiday relation feature with the values on, preceding, or following gives the algorithm a way to use expert knowledge, and it is low risk because the model is not forced to use it.
- A competition supplies a metric and a fixed, preprocessed dataset, while a real project must define the problem, collect the data, and decide what success means.
- A leaderboard score measures one metric on one dataset, so it does not fully capture a real-world problem. Platforms such as Kaggle and OpenML offer practice datasets and tasks.