What machine learning is

Machine learning appears in this syllabus because agents often need to make decisions based on patterns rather than fixed rules. In real systems, we regularly face situations where writing explicit logic would be brittle or impractical. Machine learning offers a different approach that fits naturally alongside Python programs that already process data, state, and signals.

This lesson orients us to what machine learning is and how it typically shows up inside agent-style programs, without diving into algorithms or mathematics.

What machine learning is at a high level

Machine learning is a way for programs to learn behavior from data instead of relying entirely on rules written by a programmer. Rather than specifying every decision explicitly, we provide examples and let the system infer patterns.

The result is a model: a piece of code and data that captures relationships discovered during training. Once created, that model can be used by ordinary Python programs like any other computational component.

Rules versus learned models

Rule-based systems behave exactly as written. Every condition and outcome must be anticipated in advance, and behavior changes only when the rules change.

Learned models behave according to patterns found in data. Instead of checking explicit conditions, the program asks the model to make a judgment based on what it has learned. This makes models useful when rules would be too numerous, too fragile, or too hard to express directly.

Training versus inference

Machine learning usually has two distinct phases. During training, data is used to create or adjust a model. This step is often slower and happens offline or infrequently.

During inference, the trained model is used to make predictions or classifications. Inference is what most programs actually do at runtime, calling into the model to obtain results that influence behavior.

Typical roles of ML models inside agent systems

Within an agent, a machine learning model usually serves a focused role. It might classify input, score options, detect anomalies, or estimate probabilities.

The agent remains in control of flow, state, and actions. The model acts as a specialized component that provides information the agent uses to decide what to do next.

When a local ML model is preferable to an LLM

Local machine learning models are often preferable when tasks are narrow, repeatable, and well-defined. They run quickly, cost nothing per call, and behave deterministically once trained.

In agent systems, this makes them a good fit for classification, scoring, or filtering tasks that do not require open-ended reasoning or natural language understanding.

Conclusion

At this point, we are oriented to what machine learning is and how it differs from rule-based logic. We understand the separation between training and inference, and how trained models typically fit into agent-style programs.

With this mental model in place, we are ready to look at how Python libraries make it practical to train and use simple machine learning models in real code.