Professional Documents
Culture Documents
in a Nutshell
Prof. Dr. Andreas Zinnen
Unit 0
Administration
Cluster Analysis
Submission Deadline
Review Deadline
Sample Solu3on
0 + 21
0 + 28
0 + 21
0 + 21
CV KNN ClassicaAon
0 + 21
Histograms
0 + 21
Parzen Window
0 + 21
CV Parzen Window
0 + 21
NW
Regression
(Sample)
NW
ClassicaAon
0 + 21
0 + 28
0 + 21
Note: You have to participate in the peer review process to get your exercises graded.
Dr. Andreas Zinnen
Unit 1
Introduction
Unit 1
Introduction
dear stress,
https://www.google.de/
lets break up
http://www.daserste.de/
Unit 1
Introduction
WoodenBoard
SawTooth
StarrySky-Bar
"RackWheelie"
Unit 1
Introduction
Audio:
Frequency / loudness / spectrum / amplitude /
Scribbles:
Unit 2
Cluster Analysis
Unit 2
Cluster Analysis
k-Means Clustering
Given n d-dim. observations
observations into k sets
of squares:
Unit 2
Cluster Analysis
k-Means Clustering
Algorithm (Overview):
Initialization Step
Assignment Step
Update Step
Repeat until the assignment does not change
Unit 2
Cluster Analysis
10
Unit 2
Cluster Analysis
11
Unit 2
Cluster Analysis
12
Unit 2
Cluster Analysis
13
Cluster Analysis
Download Clustering.zip and unzip the file to your computer. The folder will contain
following files:
dataClustering.mat (the data set)
Deutschland.jpg (Background image for the plots a map of Germany)
motivationClustering.m (file illustrating the problem)
solutionClustering.m (main file calling the clustering)
KMeansClustering.m (the exercise file)
14
Cluster Analysis
15
Unit 3
Regression Analysis
16
Unit 3
Regression Analysis
17
Unit 3
Regression Analysis
Assignment Step:
The value is the average of its k nearest
neighbours values.
Example:
results in
18
Unit 3
Regression Analysis
k= 8
19
Regression Analysis
Download KNNRegression.zip and unzip the file to your computer. The folder
will contain following files:
dataDrinks.mat (the data set)
motivationRegression.m (file illustrating the problem)
solutionRegression.m (main file calling the clustering)
KNNRegression.m (the exercise file)
20
Regression Analysis
21
Unit 3
Regression Analysis
k = 1 (overfitting)
k = 13 (good)
k = 50 (too general)
22
Unit 3
Regression Analysis
Each of the folds is used as a validation set at a time while the remainder is used to generate a model
fold 1
Dr. Andreas Zinnen
fold 2
Modelling and Simulation using MATLAB
fold 5
23
Unit 3
Regression Analysis
Choose best k
Note: CV will ensure that each sample will be in the test set
exactly once
24
Unit 3
Regression Analysis
25
Unit 3
Regression Analysis
26
Regression Analysis
Download CVRegression.zip and unzip the file to your computer. The folder will
contain following files:
illustrateCV.m (sample file to show how CV works)
dataDrinks.mat (the data set)
KNNRegression.m (including implementation)
implementCVRegression.m (the sample file)
27
Regression Analysis
28
Regression Analysis
Result: Choose k = 13
29
Unit 4
Classification
30
Unit 4
Classification
Classification: Introduction
Training Data: Pairs of observations
drawn from a distribution such as:
(blood status, cancer), (jets sound profile, defect), (color, part)
Goal: Estimate
k=1
Dr. Andreas Zinnen
k=7
Modelling and Simulation using MATLAB
k = 50
31
Unit 4
Classification
k-Nearest-Neighbour Classification
Idea:
For each Test Point t consider the k
nearest neighbours to assign a class
label.
Assignment Step:
Consider k (=7) nearest neighbours
2 samples belong to class 1
5 samples belong to class -1
Assign label -1
32
Unit 4
Classification
k-Nearest-Neighbour Classification
Algorithm:
For each test instance t, calculate the distance to all training samples
Sort the distance matrix in ascending order
Take k first samples, and assign the label which is most frequent among the k nearest training
samples
k= 7
33
Classification
34
Classification
35
Classification
k-Nearest-neighbour Classification
What is an adequate k?
Loop over k (e.g. 1, , 20)
Use Cross Validation to ensure that data points
will not be in training and test at the same time
Predict the label for each data point of the test
set using KNN classification
Calculate the number of correctly and wrongly
assigned samples
Choose best k
36
Classification
Download CVClassfication.zip and unzip the file to your computer. The folder
will contain following files:
woodData.mat (the data set)
KNNClassification.m (including implementation)
implementCVClassification.m (the exercise file)
37
Classification
38
Unit 5
Novelty Detection
39
Unit 5
Novelty Detection
40
Unit 5
Novelty Detection
41
Novelty Detection
42
Unit 5
Novelty Detection
43
Unit 5
Novelty Detection
this is
44
Unit 5
Novelty Detection
45
Novelty Detection
Run parzenDensity.m
Compare your results with the results of the sample solution
46
Unit 5
Novelty Detection
h = 0.01
Dr. Andreas Zinnen
h=2
Modelling and Simulation using MATLAB
47
Unit 5
Novelty Detection
48
Novelty Detection
Run parzenDensityCV.m
Compare your results with the results of the sample solution
49
Unit 5
Novelty Detection
50
Unit 5
Novelty Detection
Request:
Choose a narrow kernel width for regions with high density
Select a wide kernel width for regions with low density
Solution:
The k nearest neighbours give a rough estimate about the density
Challenge:
Find adequate c and k using Cross Validation
51
Unit 5
Novelty Detection
52
Unit 5
Novelty Detection
53
Unit 6
, weighted by
54
Unit 6
55
Download NWRegression.zip and unzip the file to your computer. The folder
will contain following files:
dataDrinks.mat (the data set)
NWRegression.m (including implementation)
implementCVRegression.m (the exercise file)
Run implementCVRegression.m
Compare your solution with the sample solution
56
Unit 6
57
Unit 6
58
Download NWClassfication.zip and unzip the file to your computer. The folder
will contain following files:
woodData.mat (the data set)
NWClassification.m (including implementation)
implementCVClassification.m (the exercise file)
solutionClassification.m
59
60