Machine Learning

Lecture 6 in the "AI" series — Block: "How Learning Works". Audience: interested adults. Duration: approx. 50 minutes (3 parts: 20 / 20 / 10).

Part 1 (20 minutes): What does learning mean for a machine? Basic understanding with analogies and examples

When we say a machine "learns", we do not mean it develops consciousness or understanding like a human; rather, we mean it improves its behavior on some measurable quantity through experience. A widely cited formal definition states: A program learns from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E (Tom M. Mitchell describes this view in detail; see Mitchell, 1997). This definition draws attention to three elements: the type of experience (e.g., examples), the task (e.g., classification), and the measurement of performance (e.g., accuracy).

A useful analogy is that of a craftsman working from examples: Imagine a carpenter is to make new shelves from old furniture. The pieces of furniture (data) provide clues about material, dimensions, and load-bearing capacity. From repeated attempts he develops a set of rules and techniques (a model) that allow him to produce new shelves that meet the requirements. Similarly, a machine learning procedure takes example data, forms an abstract rule or function, and uses that rule to make predictions for new inputs. This figurative picture corresponds to the central working principle of many learning algorithms, as presented in introductory implementations and teaching materials (see scikit-learn Tutorial).

Concrete, simple examples illustrate the process: In spam detection, incoming emails (inputs) are labeled as spam or not spam; an algorithm uses these examples to classify future unlabeled emails. In image recognition, photos are labeled ("cat", "dog") and a model is learned to assign new images. In prediction tasks (regression), historical price data are used to develop an estimator for future prices. Implementations and practical examples of this kind can be found in teaching materials and libraries such as scikit-learn.

It is important to emphasize: "Learning" in this technical sense is always goal-oriented and quantitative. It is about finding a function or decision procedure that performs well according to a defined metric. The possibility that an algorithm performs well on training data but fails on new data is a central issue, which we will explore in more depth in the next part.

Part 2 (20 minutes): Go deeper — technical terms and mechanisms

To understand the mechanics of learning, we introduce some central terms, without formal proofs but with precise meanings:

A model or hypothesis space is the set of possible functions that a learning procedure can choose from. Examples include linear functions, decision trees, or neural networks. The choice of this space restricts the kinds of relationships the system can express (see Mitchell, 1997; Hastie et al., 2009).

Features are the measurable properties of the input, such as pixel values in an image, word frequencies in a text, or age and income in a customer record. The quality and representation of features crucially influence how well a model can describe the underlying patterns; modern methods also emphasize learning useful representations automatically (see Goodfellow et al., 2016).

Loss function and optimization: To make models comparable, one defines a loss function that measures how bad a prediction is compared to the target label. Learning algorithms try to minimize this total loss over the training data; for this they use optimization methods. This principle is called empirical risk minimization and is central in many textbooks (Hastie et al., 2009; Mitchell, 1997).

Regularization is the method of adding constraints to the learning process to prevent overfitting to the training data. Overfitting occurs when a model is too flexible and learns noise instead of underlying patterns; regularization reduces model complexity or penalizes extreme parameter values (see Hastie et al., 2009).

Validation and generalization: To estimate a model's performance on unseen data, data are typically split into training and test sets and methods such as cross-validation are used to make the estimator more stable. Good validation practice is an integral part of modern implementations (see scikit-learn model selection documentation).

Types of machine learning: The scientific and practical consensus distinguishes at least three basic paradigms. Supervised learning uses labeled examples (input → desired output) and includes classification and regression; unsupervised learning works with unlabeled data and seeks structures such as clusters or principal components; reinforcement learning learns via interaction with an environment by rewarding or punishing actions (see Mitchell, 1997; Sutton & Barto, 2018). There are also intermediate forms like semi-supervised learning (combining labeled and unlabeled data) and newer approaches like self-supervised learning, which derive training signals from the data itself (Goodfellow et al., 2016).

Evaluation and metrics: For assessment one uses different metrics depending on the task — accuracy, precision/recall, F1-score for classification; mean squared error for regression; cumulative reward in reinforcement learning. The choice of metric should reflect the real objective (see scikit-learn tutorials).

Something often misunderstood is the role of dataset size: More data generally helps, but only if it is informative and representative. If the data are biased or incorrectly labeled, more quantity can even amplify the problem. Therefore, the quality of training data is at least as important as its size (see Google Cloud: "What is training data?").

Part 3 (10 minutes): Applications, limits and thought exercises

Applications: Machine learning is widely applied. Classification is used in email spam detection, medical image diagnosis, and credit decisions; regression for price forecasting and prediction; clustering for customer segmentation; reinforcement learning in robot control and game agents. Many practical examples and implementations are documented in libraries such as scikit-learn, which provide illustrative workflows for the tasks mentioned (see scikit-learn tutorials).

Limits and risks: The scientific consensus is that ML systems are powerful in many cases, but they also face clear limits. Commonly documented problems include poor generalization when there are distribution shifts between training and deployment data, biases due to non-representative or erroneous labels, lack of robustness to atypical or adversarial inputs, and the difficulty of reliably learning causality from observational data. These issues are the subject of ongoing research (see Hastie et al., 2009; Goodfellow et al., 2016).

Thought exercises to consolidate:

1) Suppose you are to build a model that predicts customer satisfaction based on survey data. Which steps would you prioritize before choosing a complex model? (Expected considerations: check data quality, representativeness, feature selection, baseline models, validation.)

2) You have an extremely accurate model on the training data, but test accuracy is significantly worse. Name possible causes and one countermeasure each. (Expected keywords: overfitting → regularization; data leakage → data preprocessing; incorrect labels → label quality checks; distribution shift → additional representative data or domain adaptation.)

3) Consider which metric truly matters in your application context: Is a high average accuracy sufficient, or is minimizing false alarms or false decisions critical? The choice of metric influences model selection and optimization.

Finally, a transparent note on uncertainties: Many practical recommendations are based on empirical experience and theoretical foundations, but there is no universal method that is optimal for all problems. Open research questions include reliable generalization bounds for complex models, formal statements on robustness to distributional changes, and efficient use of very large, heterogeneous datasets. Therefore, practical ML deployment always requires a combination of data-focused care, validated methodology, and ongoing monitoring of performance (see Hastie et al., 2009; Goodfellow et al., 2016).