Learn

What Is Machine Learning?

Machine learning fits a model from examples. Follow a practical prediction problem to understand features, parameters, loss, and the decisions that still require engineering judgment.

Learning a relationship from examples

Machine learning is a way to construct software behavior using examples. Instead of writing every decision rule, a developer chooses a model and a procedure that adjusts its parameters from data. The resulting model still executes ordinary computations. Learning changes which parameters those computations use.

In supervised learning, an example includes inputs, often called features, and a target answer or label. A model predicts the target, a loss function measures disagreement, and a training procedure searches for parameter values that reduce that loss. Google’s linear regression introduction gives a simple instance: a weighted sum of features plus a bias.

A small prediction problem

Imagine a workshop estimating how long a batch will take to pack. It records the number of boxes and the actual packing time for past batches. A deliberately simple model predicts minutes as two times the box count plus five. For ten boxes, the prediction is twenty-five minutes. The five represents setup time; the two represents time per box in this illustrative equation.

Nobody has demonstrated that this formula fits a real workshop. It is a worked example of a model. Training would estimate its two parameters from recorded batches rather than accepting our invented numbers. If the actual time for one batch were twenty-eight minutes, its prediction error would be three minutes. For that batch, the squared error is 9 minutes squared (9 min²).

This immediately raises a useful design question: are boxes enough information? Oversized packaging, fragile items, or the number of workers could matter. A more complex equation is not automatically better if the records omit the main causes of variation. Before changing models, inspect whether inputs are measured consistently and are available when a prediction is needed.

Training does not supply the whole application

The model is one part of a larger system. Someone must collect records, handle missing values, define the prediction target, choose evaluation data, and decide what happens when an estimate is unreliable. The packing screen also needs access controls and a sensible fallback when the model cannot run.

Different modeling choices make different assumptions. For example, ordinary least squares chooses coefficients by minimizing squared residuals, while regularized linear methods add constraints or penalties. The scikit-learn linear-model reference distinguishes these formulations. A penalty can discourage excessively large coefficients; it does not repair a misleading target or a broken data pipeline.

Decide whether learning is useful

If the workshop has a fixed rule that always determines packing time, implementing that rule may be simpler and easier to verify. Learning becomes attractive when useful patterns exist in examples but are inconvenient to specify directly. Even then, the practical comparison is with an appropriate alternative, such as a historical average or an explicit scheduling calculation.

Suppose predicting the same twenty-minute average for every batch is already adequate for staffing. A model must improve something important enough to justify collection, maintenance, and failure handling. A lower training loss alone does not establish that improvement. Test on batches the fitting process did not use and inspect whether errors are acceptable for actual planning.

A useful feature also has to be available at prediction time. In the workshop example, including the final recorded packing time as an input would make development results meaningless: the application is supposed to estimate that value before the work finishes. Sketch the moment of prediction and list only information that genuinely exists then. This simple exercise can reveal a surprising amount of accidental leakage before training begins.

The result is a narrower and more useful question than whether software is intelligent: can this model make this prediction reliably enough, under these conditions, to help someone act? Continue with training and inference for how the fitted model is used, then overfitting for why apparent learning may fail on new examples.