11 min 16 sec · English captions are available from the video controls and start off. To save your place and complete practice, use the learning app.
Read the video transcript
A shop needs to estimate a delivery cost before deciding what to quote the customer. One customer is five kilometers away. Another is eight kilometers away. How could a model turn those distances into estimated costs? This is Module one, Lesson one: A model is a rule for producing an output. By the end, you should be
able to calculate a simple delivery estimate, explain the difference between an input and a parameter, and say what changes during training and what happens during inference. We'll follow three steps. First, turn distance into a predicted cost. Next, add a fixed starting charge. Finally, compare choosing the rule by
hand with learning its values from examples. We'll keep the same shop throughout, so we can see exactly what changes. Start with a deliberately simple rule. Every kilometer adds two dollars to the predicted delivery cost. For five kilometers, multiply two dollars per kilometer by five kilometers. The prediction is ten dollars.
For the customer eight kilometers away, the same rule gives two times eight, or sixteen dollars. The distance changed. The amount added per kilometer stayed the same. The model maps an input to an output. Here, the input is the distance supplied to the calculation. The output is the predicted cost. Calling it a prediction means it is the model's estimate.
We haven't established what the delivery will actually cost, and we haven't decided what the customer should pay. That distinction matters in a shop. The model might estimate sixteen dollars, while the shop chooses to charge a different amount under its pricing policy. This lesson is about the rule that produces the estimate. A later lesson connects estimates to business decisions.
Let's give the quantities short names. We use the letter x for distance. Think of x as the name on a space where the distance goes. For the first delivery, x is five. For the second, x is eight. We use the letter w for the dollars added per kilometer.
In our starting rule, w is two. The rule is prediction equals w times x. You don't need a new kind of mathematics to read that. It says to multiply the amount per kilometer by the number of kilometers. The letter w names a model parameter. A parameter is a value used within the model's rule.
Learning can adjust that value using examples of actual costs. The input x describes the particular delivery; the parameter w helps specify how the model turns that input into a prediction. For these two estimates, we hold w at two and put in each delivery's distance. Producing a new prediction doesn't by itself mean that learning has taken place.
Before adding anything to the rule, check the units. Distance is measured in kilometers. The parameter is measured in dollars per kilometer. Multiplying five kilometers by two dollars per kilometer gives ten dollars. The kilometer units cancel in the calculation, leaving the cost unit we want. Now suppose someone records a route as five miles,
but the model treats the number five as kilometers. The multiplication can still be performed. It will still produce the tidy-looking number ten. But the input doesn't have the meaning the rule expects, so the result is wrong for that route. This is why a precise-looking calculation can be misleading. A computer can multiply the numbers correctly while the system uses the wrong definitions.
The input needs both a value and an agreed meaning. The parameter's units must match it. For our shop, we'll keep distance in kilometers and cost in dollars throughout. Those definitions are part of the model's meaning, rather than details to remember only after the prediction is made. Our first rule predicts zero
cost at a distance of zero. But the shop may face a starting cost before the van has traveled any distance: preparing a delivery or beginning the trip, for example. We can represent a fixed starting charge by adding another parameter. Call that fixed amount b. The rule is now prediction
equals w times x, plus b. Multiply the distance by the amount per kilometer, then add the fixed charge. Let's use an invented starting charge of three dollars, while keeping w at two dollars per kilometer. For five kilometers, two times five gives ten dollars. Add three dollars. The predicted cost is thirteen dollars.
For eight kilometers, two times eight gives sixteen dollars. Add the same three-dollar starting charge. The predicted cost is nineteen dollars. The fixed charge is added once for each prediction. It isn't multiplied by the distance. This gives us two different roles inside the rule. The parameter w controls how much the estimate rises for each additional kilometer.
The parameter b shifts the starting amount. Both help define the model's calculation. In this model, b is often called a bias or an intercept. Here, bias means a mathematical offset: the amount added to the distance-based calculation. The word has other meanings elsewhere. Social bias and sampling bias concern different issues.
When you hear bias, ask what it names in that context. You may also hear this called a linear model. Under this rule, every extra kilometer adds the same modeled amount, w. With w equal to two, moving from five to six kilometers raises the prediction from thirteen to fifteen dollars.
Moving from eight to nine raises it from nineteen to twenty-one dollars. Each increase is two dollars. If you plotted distance across a graph and predicted cost upward, these predictions would lie on a straight line. The starting charge changes where the line begins vertically. The per-kilometer parameter changes how steeply it rises.
A straight line is a useful starting point, but it also makes an assumption. It assumes that another kilometer adds the same modeled cost throughout the range we're using. Real delivery costs may behave differently. Traffic can make a short trip slow. Two routes of the same distance can take different amounts of time.
Vehicle choice can change costs. A supplier might impose a minimum charge. Time of day can matter as well. Our rule takes only distance as its input, so it cannot distinguish two deliveries with the same distance because one has heavy traffic. With the same parameters and the same distance, it returns the same prediction.
The model's capacity concerns the kinds of relationships it can represent. This particular straight-line structure can represent a constant increase per kilometer and a fixed starting charge. Adjusting its two parameters lets us choose different lines. It does not let us represent every possible pattern. That's a limitation to evaluate, rather than a reason to reject simple models automatically.
If a distance-based line gives estimates that are useful enough for the shop's purpose, it can be cheap and understandable. Staff can see how the estimate was calculated. A more complex model may improve useful accuracy, but it can also add cost. The shop needs evidence that the improvement matters enough to justify that added complexity.
A complicated model isn't automatically a better choice. We will examine evaluation in later lessons. Here, keep the question concrete: does the structure capture enough of the relationship for the intended use? So far, we chose two dollars per kilometer and a three-dollar starting charge ourselves. That is a manually written rule: a person directly selected w and b.
A learned version can use the same structure, prediction equals w times x plus b. The difference is how the parameter values are selected. A learning procedure uses examples of actual delivery costs to choose them under a specified objective. For example, the shop could collect distances and the costs that occurred. It could use a procedure that seeks parameter values
producing smaller prediction errors under a chosen measure. We haven't taught that measure or the update procedure yet. The next lessons will make those parts explicit. Notice what people still choose. They decide what output to predict, what information to provide, what model structure to use, and what objective the learning procedure should pursue. Learning selects specified values within that structure.
It does not remove those human design choices. The learned parameters might differ from our initial guesses. But once we use a particular saved set of parameter values to estimate the cost of a new delivery, we are performing inference. Inference applies the model to an input. Training can change w and b. Inference uses their current values to calculate a prediction.
A different customer supplies a different x without necessarily changing either parameter. Our small model lets us name those changes precisely. Let's check the distinction. The shop uses the model with two dollars per kilometer and a three-dollar starting charge. One delivery is five kilometers away and another is eight. What changes between the deliveries?
What can change during training? Between deliveries, x changes: the input distance is five for one and eight for the other. With the same parameters, the predictions are thirteen and nineteen dollars. During training, the learning procedure can change w and b, the values governing the rule. At inference, those learned parameters
are used with a new input. Here's one more calculation. Keep the same parameters and use a distance of six kilometers. What cost does the model predict? Two dollars per kilometer times six kilometers gives twelve dollars. Add the three-dollar starting charge, and the prediction is fifteen dollars.
That calculation applies the rule. It doesn't establish that fifteen dollars is the actual delivery cost or that the model has learned from this new delivery. We followed a distance into a prediction, added a starting charge, and distinguished manual choices from learned parameter values. The input describes the particular case.
Parameters are values within the rule. Units tell us what the quantities mean. Our linear model adds the same amount per extra kilometer, so it can be useful while still missing important real-world patterns. On the ecosystem map, we're looking inside the data-and-model part of the system. The shop's organization chooses the task
and how to use the estimate. Training takes resources, and a more complex rule has costs to justify. A working calculation is one piece of useful operation. In Lesson two, Examples, features, labels, and datasets, we'll look carefully at the examples a learning procedure receives. We'll distinguish the information available before a prediction
from the outcome it is trying to predict. That is the next step toward understanding how a rule can be learned responsibly from evidence.