Chapter 1 — Introduction to Machine Learning

Learning from data

Bryan G. Pantoja-Rosero

What to expect?

  • overview over ML/AI
  • basic understanding of most important ML methods and fundamental concepts
  • experience how ML is done on a practical problem

What not to expect?

  • instantly becoming an expert AI specialist / data scientist / ML researcher / statistician / ML software expert / domain expert
  • learn about that newest hack you saw on blog xyz.

Course website

What is machine learning?

Machine learning (ML): algorithms that learn useful relationships from data.

  • Conventional programs: rules specified explicitly.
  • ML systems: some decision rules are estimated from examples.
  • Goal: useful predictions on previously unseen inputs.
  • Learning patterns ≠ human understanding or guaranteed correctness.
  • What information is available, what do we want to predict, and how can examples help us make that prediction?

Learning rules from data

  • Example: post-earthquake damage assessment.
  • Input: photographs of buildings.
  • Desired output: damaged or undamaged.
  • Hand-crafted approach: color, shape, texture, and threshold rules.
  • ML approach: learn parameters from labeled examples.

Question: Which patterns remain useful on new photographs?

Traditional programming versus learning

Rules versus learning

Training, testing, validation

Training: estimate model parameters

Given supervised examples,

\[ \mathcal D=\{(\mathbf x_i,y_i)\}_{i=1}^{n} \]

  • \(\mathbf x_i\): input; \(y_i\): known target/label.
  • Learning algorithm updates parameters \(\mathbf w\).
  • Trained model: \(f(\mathbf x;\mathbf w)\).

Training asks: How do we estimate a model from examples?

Training, testing, validation

Inference and evaluation are not training

Inference — predict on a new input

\[\hat y=f(\mathbf x_{\mathrm{new}};\mathbf w)\]

  • The correct target does not need to be available.

Evaluation — measure predictive performance

  • Compare predictions with known targets.
  • Prefer held-out, previously unseen data.

Three distinct questions: learn? predict? reliable?

Learning functions from input–output pairs

  • The most useful way to recognize a machine-learning problem is often to identify two related kinds of information: an input \(\mathbf x\) and a desired output \(y\).
  • A collection of matched examples \((\mathbf x,y)\) provides the evidence from which we can learn a mapping.

A first classification model

Post-earthquake damage assessment

Binary task: damaged vs. undamaged buildings

  • Input: building images.
  • Data: labeled photographs that belong to one of two classes.
  • Training: estimate a classification rule.
  • Inference: apply that rule to a new image.
  • Output: building class.
  • Underlying steps: pixels → numbers → score → class.

Building damage classification

What an update can—and cannot—do

  • A wrong prediction provides a signal to change weights.
  • Updating one example may affect predictions for others.
  • A perfectly separating hyperplane may not exist.
  • Related to stochastic subgradient learning for a perceptron loss.

Central idea: prediction error drives parameter adaptation.

Machine learning is interdisciplinary

Artificial versus biological neural networks

  • The name neural network is inspired by neuroscience.
  • Artificial neuron: numerical weighted operations.
  • Biological neuron: complex electrical and chemical processes.
  • Both concern adaptive systems—but mechanisms are not equivalent.

Why machine learning matters

Why machine learning matters

A good model is not enough without reliable data and useful decisions.

Origins: learning from observations

John Snow and the 1854 London cholera outbreak

Pre-ML lesson: data patterns can guide scientific hypotheses.

Foundations of modern AI and ML

  • Durable ideas: numerical representations, learning rules, prediction.

What enabled recent progress?

Three interacting developments:

Computing capacity — vastly increased. Digital datasets — larger and more accessible. Algorithms — more effective and efficient.

Challenges of ML

Hype versus real-world reliability

  • AI has experienced cycles of enthusiasm and disappointment.
  • A convincing demonstration is not proof of reliable deployment.
  • Ask: What assumptions were made? On which data was it tested?
  • Performance must be judged in its application context.

Data, privacy, and fairness

  • Datasets reflect collection, labeling, and historical decisions.
  • Observed patterns can be biased or unrepresentative.
  • A model can reproduce unfair outcomes without an explicit unfair rule.
  • Privacy and data governance are part of system design.

Challenges of ML

Example: biased post-earthquake inspections

Evaluate coverage, representativeness, and consequences.

Challenges of ML

Interpretability and societal impact

  • Simple rules may be transparent; deep models can be harder to explain.
  • High-stakes domains need reliability and physical plausibility.
  • AI affects work, education, information, and access to services.
  • Potential misuse: misinformation and harmful automation.
  • Longer-term safety and governance questions remain under debate.

Building trustworthy ML

  • Follow the scientific method and evaluate reproducibly.
  • Document training data, assumptions, and limitations.
  • Use transparent benchmarks and independent validation.
  • Openness helps reproducibility—but balance with privacy, licensing, and safety.

Data modalities and modern applications

  • Different data can be represented numerically.
  • Task depends on input data and desired output.
  • Outcomes include classes, regions, numbers, sequences, and actions.

Next: different forms of data—and the problems they make possible.

Digital text makes large language models possible

  • Train on extensive collections of digital text.
  • Learn relationships between tokens and context.
  • Adapt for tasks: Q&A, translation, summaries, coding.
  • Powerful outputs can still be plausible but inaccurate.

Language models and generative AI

Large language models (LLMs)

  • Learn statistical patterns of human language.
  • Trained on large text collections with many parameters.
  • Many use next-token prediction as a central training objective.

Language-model capabilities over time

Source: Artificial Analysis, Frontier Language Model Intelligence, Over Time (accessed 12 October 2026). https://artificialanalysis.ai/#frontier-language-model-intelligence-over-time

Generative AI goes beyond text

  • Image generation: new images from text prompts.
  • Audio: synthetic speech and music.
  • Video: generated moving scenes.
  • Other representations: 3D data and multimodal content. Source: Max Roser (2022), The brief history of artificial intelligence: the world has changed fast — what might be next?, Our World in Data. https://ourworldindata.org/brief-history-of-ai

Generating plausible content ≠ being correct

  • Generative models learn patterns and produce new content.
  • Outputs may appear convincing but be factually wrong.
  • Validate outputs for scientific, technical, and safety-critical uses.
  • Responsible use requires knowing strengths and limitations.

From opportunities to meaningful ML problems

Ask before choosing an algorithm:

  • What decision or prediction would be useful?
  • Which inputs exist at prediction time?
  • Can we obtain reliable targets?
  • How will success be measured on unseen cases?
  • What are the costs of errors?

Example: infrastructure inspection and maintenance

  • Possible outputs: damage class, crack width, deterioration, priority.
  • Inputs: photographs, sensor data, weather, inspection history.
  • Labels: observed damage categories or measured conditions.
  • Evaluation: unseen structures, representation, consequences.

Engineering value depends on more than predictive accuracy.

From an application to a mathematical model

  • Inputs \(\mathbf x\) and outputs \(y\) define a learning problem.
  • A model \(f(\mathbf x;\mathbf w)\) makes predictions.
  • A loss function quantifies prediction errors.
  • Optimization adjusts parameters to reduce loss.
  • Generalization asks whether the model works on new cases.

Now it is your turn

Machine Learning Mini-Project

Open topic: any domain, dataset, input type, or suitable ML model.

  1. Define a problem: choose or create a dataset; identify inputs and desired outputs.
  2. Build a model: prepare data, train, and evaluate on unseen examples.
  3. Demonstrate: provide a runnable prediction/test workflow (script or notebook is fine).

Submit

  • GitHub repository with a README explaining setup, data access, retraining, testing, and results.
  • 2-page LaTex report: problem, approach, main findings, lessons learned, and relevance to your field.

Priority: clear problem + reproducible workflow + meaningful evaluation. No web app or novel algorithm required.

Coming next — regression and linear regression

  • Represent input–output relationships with mathematical functions.
  • Define predictions and measure errors with loss functions.
  • Use optimization to adjust model parameters.
  • Examine model fitting and generalization.

Simple regression models provide foundations for more advanced ML.

Acknowledgements and AI Disclosure

Acknowledgements

  • Developed with reference to CS-433 Machine Learning, École Polytechnique Fédérale de Lausanne (EPFL).
  • Adapted and extended for the present course, including civil engineering applications.
  • Independent teaching materials; no EPFL endorsement is implied.
  • Original EPFL course

Use of Generative AI

  • AI-assisted drafting, editing, examples, figures, and interactive visualizations.
  • The instructor is responsible for the final content and technical accuracy.
  • External materials are acknowledged separately.