Zum Inhalt springen

English:Machine Learning

Aus MOOCsWiki Staging
aiMOOC-Siegel

Machine Learning



Introduction

Machine learning is a field of artificial intelligence and computer science concerned with algorithms that improve their performance on a task by learning patterns from data or experience rather than being explicitly programmed with a complete set of task-specific rules. In this university-level aiMOOC, you will study the main learning paradigms, the mathematics and workflow behind model training, representative algorithms, model evaluation, generalization, neural networks, and responsible deployment.

Machine learning is not a single algorithm. It is a problem-solving framework. You begin with a question, collect or construct data, represent relevant information as features, choose a model and objective, train the model, evaluate it on unseen data, and decide whether the resulting system is useful and responsible in its intended context. A model that performs well on its training examples but poorly on new cases has not learned a useful general rule; it has overfit the training data.

You should approach every machine-learning result as an empirical claim. Ask what data were used, how the target was defined, which metric was optimized, how uncertainty was measured, whether the evaluation reflects the deployment setting, and which groups or cases might be harmed by errors.


Learning Goals

By the end of this aiMOOC, you should be able to explain major machine-learning paradigms; formulate regression, classification, clustering, and reinforcement-learning problems; distinguish parameters from hyperparameters; reason about loss functions and optimization; design sound train-validation-test procedures; select evaluation metrics that fit a real decision problem; diagnose overfitting and data leakage; explain the basic structure of neural networks; and assess fairness, transparency, privacy, and deployment risks.

You should also be able to communicate machine-learning results to technical and non-technical audiences, including the limits of the evidence. At university level, the central goal is not merely to run an algorithm but to justify why the data, model, evaluation, and interpretation are appropriate.


Foundations of Machine Learning


From Data to a Learning Problem

A dataset contains observations. An observation may be a patient record, image, transaction, sensor reading, document, molecule, or any other unit of analysis. A feature is a measured or derived input variable used by a model. A target or label is the quantity a supervised-learning system is asked to predict.

In mathematical notation, a supervised dataset is often represented as pairs of inputs and targets. The model defines a function that maps an input vector to a prediction. Training adjusts model parameters so that predictions have low error according to a chosen loss function. The trained model is then evaluated on data that were not used to fit those parameters.

A useful problem formulation requires more than available data. You need a meaningful target, an intended use, a population of interest, an acceptable error profile, and a plan for evaluating generalization. Predicting a convenient proxy is not automatically equivalent to solving the real-world problem.


Learning Paradigms

Supervised learning uses labeled examples. Typical tasks are regression, where the target is numerical, and classification, where the target represents one of several categories. Examples include predicting energy demand, estimating a chemical property, classifying an email as spam or not spam, or recognizing a type of object in an image.

Unsupervised learning works without target labels and attempts to discover structure in data. Common goals include clustering, dimensionality reduction, representation learning, and anomaly discovery. Because there is no single correct label supplied during training, evaluating whether the discovered structure is useful often requires domain knowledge or a downstream task.

Reinforcement learning concerns an agent that interacts with an environment, takes actions, receives rewards or penalties, and learns a policy intended to maximize expected cumulative reward. Reinforcement learning differs from ordinary supervised learning because feedback can be delayed and the agent's actions can influence the data it later observes.

Self-supervised learning constructs supervisory signals from the data itself. For example, a model may learn by predicting masked parts of an input or predicting one part from another. Many modern representation-learning systems use self-supervised objectives before task-specific fine-tuning.


Data, Splits, and Preprocessing


Training, Validation, and Test Data

A sound evaluation separates model development from final testing. The training set is used to estimate model parameters. A validation set can guide model choice, feature decisions, stopping rules, and hyperparameter tuning. The test set is reserved for final evaluation after the modeling choices are fixed.

If you repeatedly inspect test performance while changing the model, the test set gradually becomes part of the development process. Its performance estimate can then become optimistically biased. Cross-validation helps estimate performance efficiently during development, but a truly untouched final test set is often valuable when the stakes are high.

For grouped, temporal, spatial, or repeated-measures data, random splitting may be misleading. If observations from the same person, site, machine, or future time period occur in both training and test data, the evaluation can overstate generalization. The split strategy should reproduce the kind of novelty the deployed model will encounter.


Preprocessing and Data Leakage

Preprocessing includes operations such as scaling numerical variables, encoding categorical variables, imputing missing values, transforming skewed distributions, extracting features, and reducing dimensionality. These operations should usually be learned from the training data and then applied to validation and test data.

Data leakage occurs when information unavailable at prediction time enters the training process or when the evaluation data influence model fitting. Leakage can arise from target-derived features, improper preprocessing before splitting, duplicated observations, future information in time-series settings, or hidden links between train and test records. Leakage can make a weak system appear impressively accurate.

A reproducible workflow records data provenance, preprocessing steps, random seeds where relevant, model versions, software versions, evaluation procedures, and decision thresholds. Reproducibility does not guarantee correctness, but it makes claims easier to inspect and challenge.


Supervised Learning


Linear Regression

Linear regression models a numerical target as a linear combination of features. In its simplest form, the model predicts a response from one input using an intercept and a slope. With multiple features, the prediction is the sum of feature values multiplied by learned coefficients plus an intercept.

Ordinary least squares chooses coefficients that minimize the sum of squared residuals, where a residual is the difference between an observed target and a prediction. The squared-error objective emphasizes large residuals. Linear models are valuable because they are computationally efficient and often interpretable, but their assumptions and limitations must be examined rather than taken for granted.

Regularized linear models modify the objective to penalize coefficient magnitude. L2 regularization tends to shrink coefficients smoothly, while L1 regularization can drive some coefficients exactly to zero. Regularization can improve generalization when the unregularized model has excessive variance.


Classification

In classification, the model predicts a category or a probability distribution over categories. Logistic regression is a widely used probabilistic classifier for binary outcomes. It models a linear combination of features and maps the result to a probability using the logistic function.

A classification system usually has two conceptually separate components: a score or estimated probability, and a decision threshold that converts that score into an action or label. Changing the threshold changes the balance between false positives and false negatives. The best threshold depends on the costs and consequences of errors, not only on mathematical convenience.

A support vector machine can classify data by finding a separating boundary with a large margin between classes. Kernel methods can represent nonlinear decision boundaries without explicitly constructing every transformed feature.


Decision Trees and Ensembles

A decision tree recursively partitions feature space. Each internal node applies a decision rule, branches correspond to outcomes of that rule, and leaves produce predictions. Trees can model nonlinear interactions and are often easy to visualize, but deep trees can overfit.

Ensemble methods combine multiple models. Bagging reduces variance by training models on resampled or otherwise varied data and aggregating their outputs. random forests combine many decision trees while introducing randomness in observations and features. Boosting builds models sequentially so that later learners focus on residual error or otherwise improve the current ensemble. Ensemble models can achieve strong predictive performance, but interpretation and calibration should still be examined.

The scikit-learn algorithm-selection diagram below illustrates that model choice depends on the type, size, and structure of the problem rather than on a universal ranking of algorithms.


Unsupervised Learning


Clustering

Clustering groups observations according to a similarity or distance criterion. In k-means, you choose a number of clusters, initialize centroids, assign observations to their nearest centroid, and repeatedly update assignments and centroids until the procedure stabilizes.

K-means is sensitive to feature scale, initialization, outliers, and the geometric assumptions induced by Euclidean distance. The value of a cluster depends on the question being asked. A mathematically compact partition is not automatically a scientifically or socially meaningful grouping.

Other approaches include hierarchical clustering, density-based methods, mixture models, and graph-based techniques. Different algorithms encode different notions of similarity and cluster structure.


Dimensionality Reduction and Representation Learning

High-dimensional data can contain redundant, correlated, or noisy features. principal component analysis constructs orthogonal directions that capture decreasing amounts of variance. It is a linear technique and does not use labels.

Dimensionality reduction can support visualization, compression, denoising, or downstream modeling. However, a two-dimensional visualization can exaggerate or hide structure. A plot should be treated as a representation produced by a method with assumptions, not as a transparent picture of the data's true geometry.

Representation learning uses models to learn features automatically. In deep learning, intermediate layers can learn distributed representations that are useful for prediction, generation, retrieval, or transfer to new tasks.


Optimization, Generalization, and Model Complexity


Loss Functions and Gradient Descent

A loss function quantifies model error for one observation or a batch of observations. An objective function may combine data loss with regularization terms. Training seeks parameter values that reduce the objective.

Gradient descent updates parameters in the direction opposite the gradient of the objective. The learning rate controls the size of each update. If the rate is too large, training may become unstable or overshoot useful regions; if it is too small, learning may be very slow.

Variants include stochastic gradient descent, mini-batch gradient descent, momentum methods, and adaptive methods. Optimization success and generalization success are related but not identical: a model can achieve very low training loss and still perform poorly on unseen data.


Underfitting, Overfitting, and the Bias-Variance Perspective

Underfitting occurs when a model is too restricted, poorly trained, or inadequately specified to capture important structure. Both training and validation performance may be poor. Overfitting occurs when a model fits idiosyncrasies of the training data that do not generalize. Training performance may keep improving while validation performance stagnates or worsens.

Common responses to overfitting include collecting more representative data, simplifying the model, increasing regularization, pruning trees, using early stopping, reducing unnecessary features, or applying data augmentation when scientifically appropriate.

The bias-variance perspective offers one way to reason about model error. Highly constrained models can have high systematic error, while highly flexible models can become sensitive to sampling variation. Modern machine learning can complicate the simplest textbook picture, but the central lesson remains useful: model capacity must be evaluated through performance on genuinely unseen data.


Cross-Validation and Hyperparameter Tuning

A hyperparameter is a setting chosen outside the ordinary parameter-fitting process, such as tree depth, regularization strength, number of neighbors, or learning rate. Hyperparameters should be tuned using validation data or cross-validation rather than the final test set.

In k-fold cross-validation, the development data are partitioned into k folds. The model is repeatedly trained on k minus one folds and evaluated on the remaining fold. The results are aggregated to estimate how performance varies across splits.

Cross-validation must respect data structure. Time-series data often require chronological splits. Grouped data require group-aware splits. Hyperparameter search should be nested inside the evaluation process when you need an unbiased estimate of the complete model-selection procedure.


Evaluating Machine-Learning Models


Regression Metrics

For regression, common metrics include mean absolute error, mean squared error, root mean squared error, and the coefficient of determination. Each answers a different question. Mean absolute error preserves the original target units and weights errors linearly. Squared-error metrics penalize large deviations more strongly.

A metric should be connected to the real decision cost. A model with a lower average error may still fail badly on rare but important cases. Residual plots and subgroup analyses can reveal structure that a single summary number hides.


Classification Metrics and the Confusion Matrix

For binary classification, predictions can be summarized as true positives, false positives, true negatives, and false negatives. These values form a confusion matrix.

Accuracy is the fraction of predictions that are correct. Precision asks what fraction of predicted positive cases are truly positive. Recall asks what fraction of actual positive cases are detected. The F1 score combines precision and recall through their harmonic mean.

On imbalanced datasets, accuracy alone can be misleading. A model can achieve high accuracy by predicting the majority class while failing on the class that matters. You should inspect per-class performance, thresholds, calibration, and the cost of each error type.


ROC Curves, Calibration, and Thresholds

A receiver operating characteristic curve plots true-positive rate against false-positive rate across thresholds. The area under the curve summarizes ranking performance across thresholds, but it does not encode the real-world costs of false positives and false negatives.

Calibration concerns whether predicted probabilities correspond to observed frequencies. A well-calibrated model that predicts a probability near 0.8 for many comparable cases should be correct about 80 percent of the time in that group, under the evaluation conditions. Ranking quality and calibration are distinct properties.

Threshold selection should be treated as a decision problem. In a medical screening system, a false negative may have a very different cost from a false positive. In a fraud system, operational review capacity may constrain how many alerts can be investigated. Metrics must therefore be chosen in relation to consequences.


Neural Networks and Deep Learning


Layers, Activations, and Parameters

An artificial neural network composes many parameterized transformations. A feedforward network typically contains an input layer, one or more hidden layers, and an output layer. Connections carry weights, neurons combine weighted inputs with biases, and nonlinear activation functions allow the network to model complex relationships.

Training a neural network usually involves a forward pass to compute predictions, a loss function to measure error, backpropagation to compute gradients efficiently, and an optimizer to update parameters. Deep networks can learn powerful representations but often require large datasets, substantial computation, careful regularization, and rigorous evaluation.


Convolution, Attention, and Transfer Learning

Convolutional neural networks use shared local filters and have been especially influential in image and spatial-data tasks. Transformers use attention mechanisms to model relationships among elements of a sequence or set and have become central in natural-language processing and many multimodal systems.

Transfer learning begins with a model trained on one task or large source dataset and adapts it to another task. This can reduce the amount of task-specific labeled data required. However, transferred models can also transfer biases, artifacts, vulnerabilities, or domain mismatches from their source training.

Deep learning is a subset of machine learning, not a synonym for the entire field. Many problems are better served by simpler models because they are cheaper, easier to interpret, easier to validate, or more appropriate for the amount and structure of available data.


End-to-End Machine-Learning Workflow


Problem Formulation

Start with the decision or scientific question, not the algorithm. Define the population, prediction target, prediction time, action that may follow, acceptable errors, and baseline. Ask whether machine learning is actually needed. A deterministic rule, statistical model, or improved data collection process may solve the problem more effectively.

Establish a baseline before developing complex models. A baseline might be a simple mean predictor, a majority-class classifier, a linear model, or an existing human or operational process. A sophisticated model is only valuable if it improves a relevant outcome enough to justify additional complexity and risk.


Data Engineering and Feature Design

Inspect missingness, measurement error, label quality, sampling processes, class imbalance, outliers, duplicates, and drift over time. Document why each feature will be available at the moment the model makes a prediction.

Feature engineering can encode domain knowledge through transformations, interactions, aggregations, temporal windows, or scientifically meaningful representations. Automated representation learning can reduce manual feature design, but it does not remove the need to understand data-generating processes.


Training, Tuning, and Evaluation

Build preprocessing and modeling steps into a reproducible pipeline. Tune hyperparameters using validation procedures that match the deployment setting. Compare against baselines and report uncertainty when possible.

Evaluation should include more than an aggregate score. Inspect subgroup performance, confidence intervals or resampling variability where appropriate, calibration, robustness to plausible shifts, extreme cases, and operational constraints. Error analysis can reveal that the next improvement should come from better labels or data rather than a more complex algorithm.


Deployment, Monitoring, and Maintenance

Deployment changes the environment in which a model operates. Data distributions can shift, user behavior can adapt, sensors can change, and the model's decisions can influence future data. A production system therefore needs monitoring for data quality, drift, performance degradation, latency, failures, and unintended consequences.

Model retraining should be governed by explicit criteria rather than performed automatically without inspection. You need version control for data and models, rollback plans, monitoring dashboards, documentation, ownership, and procedures for human review when the model is uncertain or the stakes are high.


Responsible Machine Learning


Fairness, Bias, and Accountability

Machine-learning systems can reproduce or amplify biases present in data, labels, sampling processes, objectives, and institutional practices. High average accuracy does not demonstrate fair performance. Evaluation should examine relevant subgroups and consider how harms are distributed.

Fairness has multiple formal definitions that can conflict with one another. There is no universal metric that resolves every ethical question. You must connect technical evaluation to the social setting, legal requirements, affected communities, and the consequences of decisions.

Accountability means that responsibility remains with people and institutions. A model does not eliminate the need for governance. High-stakes uses may require documentation, audit trails, contestability, human oversight, security review, privacy protection, and clear procedures for handling errors.


Interpretability, Explainability, and Uncertainty

An interpretable model is one whose reasoning can be understood through its structure, parameters, or decision process. Post-hoc explanation methods attempt to describe the behavior of more complex models. Explanations can be useful, but they can also be unstable or misleading if treated as proof of causal reasoning.

Prediction is not causation. A feature can be strongly predictive without causing the target. If your goal is to estimate the effect of an intervention, causal assumptions and research design are central. Machine learning can assist causal analysis, but predictive accuracy alone cannot establish causal effects.

Uncertainty should be communicated explicitly. Sources include sampling variability, measurement noise, model uncertainty, distribution shift, label ambiguity, and incomplete knowledge. A responsible system distinguishes between a confident prediction under familiar conditions and an uncertain extrapolation far from the training distribution.


Applications and Limits

Machine learning is used in computer vision, natural-language processing, speech recognition, recommender systems, anomaly detection, forecasting, robotics, scientific discovery, healthcare research, finance, manufacturing, cybersecurity, and many other fields. The same technical method can have very different implications across domains.

Useful machine learning requires alignment among the problem, data, metric, deployment context, and human goals. Poorly chosen targets can optimize the wrong behavior. Biased data can encode inequities. Distribution shift can invalidate previously strong performance. Automated predictions can also create feedback loops that change future data.

For university-level work, a strong machine-learning project therefore combines mathematical understanding, software competence, experimental design, domain knowledge, and critical reflection. The most impressive model is not necessarily the most useful model; the strongest system is the one whose claims survive careful evaluation.


Interactive Tasks


Quiz: Test Your Knowledge

Which dataset should normally remain untouched until final model evaluation? (Test set) (!Training set) (!Augmented set) (!Feature set)




What is the primary goal of supervised learning? (Learn a mapping from inputs to labeled targets) (!Discover structure without labels) (!Choose actions only from rewards) (!Remove all uncertainty from data)




What does overfitting mean? (The model learns training-specific patterns that do not generalize) (!The model has too few input features) (!The model uses only linear functions) (!The model has perfect test performance)




Which metric asks what fraction of predicted positive cases are truly positive? (Precision) (!Recall) (!Accuracy) (!Variance)




What is a hyperparameter? (A setting chosen outside ordinary parameter fitting) (!A label predicted by the model) (!A single training observation) (!A residual from regression)




Why is data leakage dangerous? (It makes evaluation performance unrealistically optimistic) (!It guarantees lower training accuracy) (!It prevents models from using features) (!It converts regression into clustering)




What does gradient descent use to update model parameters? (The gradient of the objective function) (!The test labels only) (!The alphabetic order of features) (!The number of classes alone)




Which task is most directly associated with k-means? (Clustering) (!Binary classification) (!Sequence generation) (!Causal identification)




What does calibration assess for a probabilistic classifier? (Whether predicted probabilities match observed frequencies) (!Whether all coefficients equal zero) (!Whether clusters have equal size) (!Whether training uses every observation)




What is a central purpose of cross-validation? (Estimate generalization during model development) (!Replace every final test set automatically) (!Guarantee fairness across all groups) (!Prove that correlation is causation)





Memory Game

Feature Input variable used by a model
Target Quantity a supervised model is trained to predict
Regularization Constraint or penalty used to discourage excessive model complexity
Recall Fraction of actual positive cases detected
Centroid Representative center used in k-means
Epoch One complete pass through a training dataset
Calibration Agreement between predicted probabilities and observed frequencies
Leakage Improper use of information that would not be available in genuine prediction





Drag and Drop

Match the correct terms. Topic
Classification Predict a categorical target from labeled examples
Regression Predict a numerical target from labeled examples
Clustering Discover groups in unlabeled data
Cross-validation Repeatedly evaluate models on held-out development folds
Regularization Penalize or constrain model complexity




Match each machine-learning concept to the description that best captures its role in a modeling workflow.


Crossword Puzzle

Gradient What mathematical direction indicates how an objective changes with its parameters?
Clustering What unsupervised task groups similar observations?
Precision What metric is the fraction of predicted positives that are truly positive?
Leakage What problem occurs when unavailable or evaluation information improperly enters training?
Regularization What technique discourages excessive model complexity by adding constraints or penalties?
Calibration What property describes agreement between predicted probabilities and observed frequencies?





LearningApps


Cloze Text

Complete the text.
In supervised learning, the model learns from inputs paired with

. The data used to estimate model parameters are called the

set. A separate

set helps evaluate final generalization. When a model fits training-specific noise rather than reusable structure, it is

. A function that quantifies prediction error is called a

function. In binary classification, the fraction of predicted positive cases that are truly positive is

. Repeated development splits can be organized through

. Responsible evaluation should also examine subgroup performance and potential

.




Open-Ended Tasks


Easy

  1. Machine learning glossary: Create a one-page visual glossary of twelve core terms from this course and add one original example for each term.
  2. Baseline model: Choose a simple prediction problem, define a sensible baseline, and explain what a machine-learning model would have to improve to be worth using.
  3. Confusion matrix analysis: Invent a small binary-classification scenario, construct a confusion matrix, and write a short explanation of which error type matters more and why.
  4. Media explanation: Select one Wikimedia Commons diagram used in this course and record a two-minute video in which you explain the machine-learning concept shown.


Standard

  1. Train validation test design: Design a split strategy for a dataset with repeated observations from the same people and justify how your method prevents leakage.
  2. Model comparison: Train at least two supervised-learning models on the same open dataset, compare them with an appropriate metric, and discuss the result without relying on accuracy alone.
  3. Clustering investigation: Apply a clustering method to an open dataset, visualize the groups, vary at least one preprocessing choice, and explain how that choice changes the interpretation.
  4. Machine learning interview: Interview a researcher, engineer, analyst, or domain expert about one real use of machine learning and summarize how data quality, evaluation, and human judgment affect the system.


Advanced

  1. Reproducible machine learning project: Build a complete reproducible notebook or repository that includes data documentation, preprocessing, a baseline, model training, cross-validation, final testing, error analysis, and a limitations section.
  2. Fairness audit: Evaluate a classifier across relevant subgroups, compare at least two fairness-related performance views, and explain why no single metric completely resolves the ethical questions.
  3. Distribution shift experiment: Create or identify a dataset split that simulates a plausible shift between training and deployment, measure the resulting performance change, and propose monitoring or mitigation strategies.
  4. Research replication: Select a peer-reviewed machine-learning study with accessible data or code, reproduce one central result, document deviations from the original setup, and create a short presentation evaluating the strength of the evidence.



Learning Assessment

  1. Problem formulation assessment: Given a real-world scenario, define the prediction target, unit of observation, prediction time, features, intended action, baseline, and main sources of harm or uncertainty.
  2. Evaluation design assessment: Design a train-validation-test or cross-validation scheme for grouped or temporal data and justify why the scheme gives a credible estimate of future performance.
  3. Metric selection assessment: Compare accuracy, precision, recall, F1, and ROC-based evaluation for an imbalanced classification problem and defend a metric and threshold choice using the consequences of errors.
  4. Generalization assessment: Interpret training and validation curves, diagnose underfitting or overfitting, and propose at least three interventions with explanations of why each might help.
  5. Responsible ML assessment: Analyze a hypothetical high-stakes model for leakage, fairness, privacy, transparency, feedback loops, and human-oversight requirements, then prioritize the risks.
  6. Transfer assessment: Take a method learned in one domain, such as image classification or demand forecasting, and explain what would have to change before the method could be responsibly transferred to a different domain.




Evidence of Learning

Strong evidence of learning includes knowledge of learning paradigms, model families, objectives, optimization, validation, and evaluation metrics; skills in data preparation, model fitting, cross-validation, error analysis, visualization, reproducible experimentation, and critical interpretation; products such as notebooks, reports, model cards, visual explanations, presentations, and reproducible repositories; and transfer achievements in which you can reformulate an unfamiliar problem as a machine-learning task and justify choices about data, metrics, models, and governance.

You should be able to explain not only what a model achieved but also what the evidence does not establish. High-quality work identifies assumptions, reports limitations, separates predictive association from causation, and connects technical performance to the consequences of deployment.




OERs on the Topic

The English Wikipedia article offers a broad overview of machine learning, including its history, approaches, theory, applications, and relationship to other fields.


Additional freely accessible learning resources include the artificial intelligence, deep learning, statistical learning theory, data mining, regression, classification, clustering, and reinforcement learning topics available through open encyclopedic and educational resources.


Linked Learning Areas

Machine learning connects strongly with Computer science, Statistics, Linear algebra, Calculus, Optimization, Probability theory, Software engineering, Data science, Artificial intelligence, and domain-specific research methods. In professional contexts it is relevant to data scientists, machine-learning engineers, software developers, statisticians, quantitative researchers, product teams, and subject-matter experts who design or evaluate data-driven systems.


aiMOOC Projects

MOOCwiki · Deutsch

Nach dem Lernen ist vor dem Lernen

Entdecke direkt den nächsten Lernkurs. Weitere Inhalte erscheinen, wenn Du weiter nach unten scrollst.

Zur MOOCwiki-Hauptseite

Mediathek

Mediathek

Inhalte werden geladen ...

Mediathek wird aus dem Wiki geladen ...