03 Dimensionality Reduction
03 Dimensionality Reduction
Reduction
Course: Artificial Intelligence
Fundamentals
Supervised Unsupervised
Discrete Data
Classification Clustering
(predict a label) (group similar items)
Continuous Data
Dimensionality
Regression Reduction
(predict a quantity) (reduce n. of variables)
Machine Learning Tasks
Supervised Unsupervised
Discrete Data
Classification Clustering
(predict a label) (group similar items)
Continuous Data
Dimensionality
Regression Reduction
(predict a quantity) (reduce n. of variables)
Section Agenda
• Different strategies:
- Feature Selection
- Feature Projection
Feature Selection
• A subset of the original variables is used
From:
To:
Dimensionality
Reduction
Algorithms
Principal Component Analysis
VAR 1 VAR 2
12 32
54 56
34 34
… …
var 1
PCA by Example
var 2
var 1
PCA by Example
var 2
Take the average for
the first dimension
X
var 1
PCA by Example
var 2
and for the other dimension
X
var 1
PCA by Example
var 2
centre of the data set
X X
X
var 1
PCA by Example
shift the data set
var 2 so that the centre
corresponds to the origin
var 1
PCA by Example
var 2
X
var 1
PCA by Example
var 2
Relative positions:
still the same
X
var 1
PCA by Example
var 2
Fit a line that goes
through the origin
X
var 1
PCA by Example
var 2
Start random
var 1
PCA by Example
var 2
Rotate the line
var 1
PCA by Example
var 2
until you find the best fit
var 1
PCA by Example
X
X
X
var 1
X
X
X
PCA by Example
var 2 - minimise:
d(point, line)
- maximise:
X d(project, origin)
X
X
var 1
X
X
X
PCA by Example
• Minimising the distance from the point to the line, or
maximising the distance from the projection to the
origin are equivalent (Why?)
var 1
PCA by Example
var 2
This line represent the
first principal component
(or PC1)
var 1
PCA by Example
PC1
var 1
PCA by Example
var 2 Finding the values:
PC2 rotate the PCs so that
PC1 is horizontal
PC1
var 1
PCA by Example
PC2 Finding the values:
rotate the PCs so that
PC1 is horizontal
PC1
PCA by Example
PC2 Finding the values:
rotate the PCs so that
PC1 is horizontal
PC1
PCA Discussion
• The components are ordered by variance
i.e. the first component is the one with the highest
variance