AI Foundations

How Machine Learning Works, Explained Simply

The Core Idea: Learned Patterns, Not Fixed Rules

Traditional software follows rules that people write out: "If the amount exceeds CHF 10,000, flag the payment." That works as long as every case fits neatly into such if-then rules. For complex tasks like understanding language, recognising images or forecasting demand, the list of rules quickly becomes unmanageable.

Machine learning flips this around: instead of specifying rules, you show the system many examples and let it work out the underlying patterns itself. From thousands of flagged and unflagged payments, a model independently infers what looks suspicious. The result is not a rigid program but a statistical model based on probabilities.

Training and Inference: Every Model's Two Phases

Every ML project runs through two clearly separated phases. Training is compute-intensive and happens once or periodically; inference then runs many times and fast. This distinction also explains the cost structure: training costs a lot of compute up front, inference costs per request.

  • Training: the model sees example data and gradually adjusts its internal parameters to reduce errors. The output is a finished, saved model.
  • Inference: the trained model receives new, unseen data and returns a prediction, without learning further in the process.
  • Validation: between the two phases, the model is checked on held-out test data to see whether it truly generalises rather than just memorising.

The Three Types of Learning at a Glance

  • Supervised learning: the training data is labelled with the correct answer. Example: emails marked "spam" or "not spam". Ideal for classification and predicting concrete values.
  • Unsupervised learning: the data has no labels. The model finds structure on its own, such as customer segments or outliers. Ideal for grouping (clustering) and anomaly detection.
  • Reinforcement learning: an agent learns by trial and error through reward and penalty, for example in robotics or games. Less common in everyday use but important for sequential decisions.
  • Hybrid forms such as semi-supervised and self-supervised learning combine a few labels with lots of unlabelled data, the basis of modern language models.

Why Data Quality Decides Success

A model can only be as good as the data it learns from. The familiar principle "garbage in, garbage out" applies especially strongly in machine learning: faulty, incomplete or skewed training data produces models that deliver confidently wrong results. More data only helps when it is relevant and clean.

  • Representativeness: the training data must reflect the later reality. If whole groups are missing, the model performs poorly for them.
  • Bias: if data reflects historical inequalities, the model learns them too and may amplify them.
  • Freshness: as the world changes, a model becomes outdated ("data drift") and must be retrained.
  • Label quality: in supervised learning correct labels are everything, mislabelled examples teach the model the wrong thing.

A Simple Example From Start to Finish

Suppose an SME wants to estimate property prices. You gather historical sales with features such as area, location and year built, plus the actual price (the label). This table is the training dataset for a supervised model.

During training, the algorithm looks for the relationship between features and price and adjusts its parameters until its estimates come as close as possible to the real prices. You then check accuracy on held-out sales. In inference, you enter the features of a new, unsold flat and receive a price estimate. If the market shifts, you retrain the model with fresh data.

Limits and Common Misconceptions

  • ML does not understand like a human: a model spots statistical patterns, not meaning or cause. Correlation is not causation.
  • Overfitting: if a model memorises the training data, it fails on new cases. Hence the separate test phase.
  • No common sense: outside the data it has seen, a model can produce nonsensical outputs without "noticing".
  • Not always the right choice: for clear, stable rules, classic programs are often simpler, cheaper and more transparent than ML.

Swiss Perspective: Data Protection and Responsible Use

Because machine learning runs on data, in Switzerland it directly touches the revised Data Protection Act (revDSG/nFADP). Anyone using personal data for training needs a valid legal basis, must inform transparently and observe the principles of data minimisation and purpose limitation. The supervisory authority is the Federal Data Protection and Information Commissioner (FDPIC/EDÖB).

In practice this means: document data provenance, check datasets for bias, keep models explainable, and provide human oversight for sensitive decisions. Especially for Swiss SMEs, clean data handling is not a brake but a trust advantage with customers and partners.

Frequently asked questions

What is the difference between machine learning and artificial intelligence?

Artificial intelligence (AI) is the umbrella term for systems that solve tasks normally requiring human intelligence. Machine learning is a subfield of AI that learns patterns from data instead of being given rules. Deep learning, in turn, is a subfield of machine learning using multi-layered neural networks.

What does training mean compared to inference?

Training is the learning phase: the model adjusts its internal parameters from many examples and improves. Inference is the application phase: the finished model receives new data and returns a prediction without learning further. Training is compute-intensive and one-off or periodic; inference runs fast and frequently.

What is the difference between supervised and unsupervised learning?

In supervised learning the training data is labelled with the correct answer, for example images tagged "cat" or "dog"; the model learns to predict that answer. In unsupervised learning such labels are absent, and the model finds structure like groups or outliers on its own. Supervised suits prediction, unsupervised suits discovery in the data.

Why is data quality more important than data quantity?

A model learns exactly what is in the data. Large amounts of faulty, outdated or skewed data lead to confidently wrong predictions. Clean, representative and correctly labelled data often produces better results than huge but messy datasets. Quality also reduces the risk of bias and legal problems.

Do you need maths to understand machine learning?

To understand the basic principle, no: the idea that a system learns patterns from examples and applies them to new cases is enough. Those who build models need statistics, linear algebra and some calculus. For leaders and users, a solid conceptual grasp of training, inference, data quality and limits is entirely sufficient.

What data protection rules apply in Switzerland?

If personal data is used for training or inference, the revised Data Protection Act (revDSG/nFADP) applies. You need a legal basis, must inform transparently, and observe data minimisation and purpose limitation; the FDPIC (EDÖB) supervises. It is advisable to document data provenance, check for bias, and keep human oversight for sensitive automated decisions.

Key terms in the glossary

← Back to overview

Practical AI for your business

From idea to implementation – we show you what is concretely possible in your case.

Request a demo