Introduction to Machine Learning

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/52

flashcard set

Earn XP

Description and Tags

FS2026

Last updated 1:58 PM on 6/23/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

53 Terms

1
New cards

Simplified diagram of machine learning

knowt flashcard image
2
New cards

Supervised Learning - Definition

Learning with training data that contains inputs together with correct outputs (= labels). The Goal here ist to predict the correct output.

3
New cards

Unsupervised Learning - Definition

Learning with training data that contains only inputs and no labels. The Goal here is to discover useful structure in the data.

4
New cards

Examples of supervised learning:

Classification, Regression, Structured prediction

5
New cards

Examples of unsupervised learning

Clustering, Anomaly detection, Dimensionality reduction, Generative Modeling

6
New cards

Simplified diagram of supervised learning:

Prediction y can also be called y^, or f^(x)

<p>Prediction y can also be called y^, or f^(x)</p>
7
New cards

Simplified diagram of unsupervised learning:

knowt flashcard image
8
New cards

Goals of unsupervised Learning: 2 concepts

1) Describe new input x relative to training data (is it similar, is it an anomaly?, etc.)
2) Generate new data x’ that looks similar to training data (Generative modeling)

9
New cards

Machine Learning Pipeline for linear Regression

Linear Regression is always linear functions, squared loss, closed-form, no matter the dimension

<p>Linear Regression is always linear functions, squared loss, closed-form, no matter the dimension</p>
10
New cards

Difference House Prices (Linear Regression) example between 1 Dimension and d Dimensions

1D: We only have one attribute x (x is 1D) → E.g. x = (size)
dD: We have d attributes → x is dD → E.g. x = (size, #bathrooms, …, years since construction)

11
New cards

How can the linear function class be represented in 1d?

knowt flashcard image
12
New cards

Linear function equation:

f(x) = w0 + w1*x with w0: y-Achsenabschnitt, w1: Steigung

13
New cards

Linear Regression:

Function Class F: Linear Functions

Training Loss L: Squared Loss

Optimization: We can use closed Form solution

14
New cards

Characteristics of different Losses: Squared, Huber, Asymmetric

Squared Loss: Symmetric → Overestimation and Underestimation are treated equally, large penalty on outliers (because grows quadratically)

Huber Loss: Ignores outliers

Asymmetric Losses: Weigh over- and underestimation differently

15
New cards

Feature Vector x in 1D:

X = (x1, …, xn) mit x1, …, xn 1D

E.g. x_i = (size)

<p>X = (x1, …, xn) mit x1, …, xn 1D</p><p>E.g. x_i = (size)</p>
16
New cards

Feature Vector x in dD:

X = (x1, …, xn) mit x1, …, xn dD

E.g. x_i = (size, #bathrooms, …, years since construction)

<p>X = (x1, …, xn) mit x1, …, xn dD</p><p>E.g. x_i = (size, #bathrooms, …, years since construction)</p>
17
New cards

Linear Regression Closed Form:

w = (X^TX)^(-1)X^Ty

18
New cards

19
New cards

What changes if we use nonlinear regression?

Function Class F: We can use nonlinear functions

Optimization: Gradient Descent can be used (it’s always used when there is no closed form or closed form is computationally expensive)

20
New cards

General Form of nonlinear functions in ML Pipeline:

Some ML models have fixed phi (linear regression, kernel regression, etc.), phi maps d dimensions (from input) to p dimensions

Nonlinear in x, linear in phi

<p>Some ML models have fixed phi (linear regression, kernel regression, etc.), phi maps d dimensions (from input) to p dimensions</p><p>Nonlinear in x, linear in phi</p>
21
New cards

Matrix notation of loss L(w) of nonlinear function (also squared loss)

knowt flashcard image
22
New cards

Why can/can’t we use closed form for nonlinear functions?

We can use it, we only have to replace X matrix with Phi matrix.
Problem: Phi^TPhi can have a high computational cost to compute and there is a lack of generality for different losses (other than squared loss)

→ That’s why we need gradient descent

23
New cards

What do we use Gradient Descent for?

It’s a general iterative algorithm to minimize our loss L(w) and thus find out our weight vector w for our model f.

24
New cards

Gradient Descent in 1D: 1. In which direction do we move? 2. How far in that direction? 3. When should we stop?

  1. In direction of sign of negative derivative at w_now

  2. nü~ = nü*|L’(w_now)| → In direction of nü

  3. Stop when it can’t improve much anymore, so for example when: |L(w_now) - L(w_previous)| <= epsilon

25
New cards

What changes when we execute Gradient Descent in nD than in 1D?

For minimizing L(w) we have multiple directions in which to go to. → We need gradient (because gradients point in direction of steepest descent)

26
New cards

Geometric Intuition of contour lines in relation with Gradient Descent:

  • Steepest direction is orthogonal to contour lines

  • Direction of steepest increase: ∇L(w)

  • Direction of steepest decrease: -∇L(w)

27
New cards

What does hold on contour lines?

On those lines the loss has the same value.

28
New cards

Gradient Descent algorithm:

knowt flashcard image
29
New cards

True or False: We can use machinery from linear regression to solve regression in nonlinear function spaces by just replacing the data matrix 𝑋 by the feature matrix Φ

True

30
New cards

How can we rewrite the Squared Loss in matrix notation?

knowt flashcard image
31
New cards

Which of the following statements are true?
(A) All convex functions have only one local minimum that is a global minimum
(B) For convex functions, all stationary points are local minima
(C) For convex functions, all stationary points are global minima

(B) and (C) are true immediately if you plug in ∇𝐿 𝑤 = 0 in first order condition

32
New cards

Relation Convexity and global/local minima

knowt flashcard image
33
New cards

Why does Gradient Descent work for linear Regression?

Because linear Regression with squared Loss is a convex problem. Convergence is only guaranteed for the convex case. (otherwise we can get stuck in local minima or diverge to infinity)

34
New cards

What holds for the 2 norm squared?

knowt flashcard image
35
New cards

What is Conditioning?

It tells us how nicely shaped the loss landscape is. If the contour lines (= same loss values) are more spheres we have a well conditioned case, and if they are more ellipses we have an ill conditioned case.

36
New cards

Well-conditioned case of GD?

λmax ​≈ λmin​, contour lines are almost circles, loss equally steep in all directions, GD works

37
New cards

Ill-conditioned case for GD

λmax​ » λmin, contour lines are stretched ellipses, one direction very steep, the other flat → small stepsize: slow in flat direction, large stepsize: oscillations in steep direction
→ Solution for ill-conditioned case → use Momentum/accelerated methods​

38
New cards

Momentum/accelerated methods to find minima:

Momentum speeds up flat directions, speeds up GD (Gradient Descent)

39
New cards

Why SGD (Stochastic Gradient Descent)?

It uses a different loss than GD (not gradient over all points but only on a random subset of points, which is called mini batch with batch size |S|). This saves memory, when the batch size is smaller than n
→ works because minibatch gradient is correct on average (Expectation value)

40
New cards

Full batch GD, Original SGD, Minibatch SGD?

Full batch: |S| = n, Original: |S| = 1, Minibatch: 1 < |S| < n (Full batch = normal GD)

41
New cards

Effect on batch size in SGD?

|S| small → cheap but noisy, but this can sometimes also escape saddle points

|S| large → expensive but stable (closer to GD, can more and more get stuck in stationary points)

42
New cards

What is convexity? Explain with the 3 conditions.

Function is convex if it has a “bowl shape”.


0-th order condition: Real function always below linear connection of two random points.

1-st order condition: Tangent of two points always below function.

2-nd order condition: Curvature is always non-negative .

43
New cards

What is strong convexity?

Stronger than convexity. It holds: strong convex → unique global minimum, It means that the loss landscape is curved enough so that there is only one best solution.

44
New cards
<p>Characterize the following functions:</p>

Characterize the following functions:

knowt flashcard image
45
New cards

Training Loss, Generalization Error and Estimation Error?

Training Loss: Measures error on trainings data D. L(f;D)

Generalization Error: Measures expected error on new data. L(f;P) (P is the joint distribution that we assume our test data is drawn from and our trainings data is randomly sampled from)

Estimation Error: Measures how far the learned model is from the ideal model f*.

46
New cards

Linear Regression, what underparametrized case, overparametrized case and n=d mean for the errors and amount of solutions for our problem.

Underparametrized n>d: More samples than parameters, if we increase n our model sees more data and thus the effect of noise gets averaged out, Estimation Error shrinks, usually unique solution

Overparametrized n<d: More parameters than samples, More DoFs than constraints from Data → infinitely many solutions, Training error can be zero, b.c. we can fit data perfectly

n=d: Possibly a unique solution

Main Message: More samples usually help, but in high dimensions (n<d) many different models can fit the training data perfectly, and not all of them generalize well.

47
New cards

Definition Model complexity

means how flexible the function class F is. F0 = constant functions, F1 = linear, F2 = quadratic, etc.

Higher model complexity → more flexible functions → Fit data better → Training error shrinks

48
New cards

Definition Underfitting

Model is too simple and can’t capture the true relationship.

49
New cards

Definition Overfitting:

Model is too complex and fits random noise in training data.

50
New cards

Overview: Relationship model complexity vs. Training/Generalization Error

knowt flashcard image
51
New cards

Sources for generalization error:

Bias, Variance, Irreducible noise

→ Important: Generalization Error can exist without noise because of Bias and Variance, from not being able to fit the function (bias) and/or from seeing only few samples (Variance)

52
New cards

Bias-Variance tradeoff in choosing model complexity

Simple Models: High Bias, Low Variance

Complex Models: Low Bias, High Variance

Good Models: Balance

53
New cards

Definition Bias and Variance with pictures in mind

Bias: Distance between average over all different models for different data sets D1, D2, .. and ideal model f*

Variance: Summarized Distance between individual models fD and average over all models.

<p>Bias: Distance between average over all different models for different data sets D1, D2, .. and ideal model f*</p><p>Variance: Summarized Distance between individual models fD and average over all models. </p>