Game Theory and AI - a Unified Approach to Poker Games by Frans Oliehoek
Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht...
Transcript of Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht...
![Page 2: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/2.jpg)
Recap
Overview scientific computing exact science: mathematical models
(precise understanding!) (high-level) programming: Mathematica, Matlab topics
Introduction Mathematica population models via difference equations
(also 'recurrence equations' hence 'RSolve')pn+1=f ( pn)
![Page 3: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/3.jpg)
This Lecture
A introduction to Matlab
Principle Component Analysis
Floating Point Numbers
![Page 4: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/4.jpg)
Matlab
'Matrix' laboratory primarily: numerical computing
learn by doing! different numbers:
no π or 'how many digits you like' but: floating point numbers
Octave
![Page 5: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/5.jpg)
Principal Component Analysis
![Page 6: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/6.jpg)
Dimension Reduction
High dimensional data apple: weight, length, circumference, color, taste, etc.
Hard to understand / visualize!
Dimension reduction: reduce the number of variables i.e., reduce the number of dimensions from D to d
(x1, x2, ... , xD)→(z1, z2, ... , zd)
(x1, x2, ... , xD)
![Page 7: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/7.jpg)
Dimension Reduction
In the lab: measurements about Brachiopods
![Page 8: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/8.jpg)
PCA – Goals
Given a data set X of N data point of D variables→ convert to data set Z of N data points of d variables
(x1(0) , x2
(0) , ... , xD(0))→(z1
(0) , z2(0) , ... , zd
(0))
(x1(1) , x2
(1) , ... , xD(1))→(z1
(1) , z2(1) , ... , zd
(1))
...(x1
(n) , x2(n) , ... , xD
(n))→(z1(n) , z2
(n) , ... , zd(n))
N=n+1
![Page 9: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/9.jpg)
PCA – Goals
Given a data set X of N data point of D variables→ convert to data set Z of N data points of d variables
(x1(0) , x2
(0) , ... , xD(0))→(z1
(0) , z2(0) , ... , zd
(0))
(x1(1) , x2
(1) , ... , xD(1))→(z1
(1) , z2(1) , ... , zd
(1))
...(x1
(n) , x2(n) , ... , xD
(n))→(z1(n) , z2
(n) , ... , zd(n))
The vector
is called the i-th principal component (of the data set)
(z i(0) , zi
(1) , ... , z i(n))
![Page 10: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/10.jpg)
PCA – Goals
Given a data set X of N data point of D variables→ convert to data set Z of N data points of d variables
PCA performs a linear transformation:→ variables z
i are linear combinations of x
1,...,x
D
(x1(0) , x2
(0) , ... , xD(0))→(z1
(0) , z2(0) , ... , zd
(0))
(x1(1) , x2
(1) , ... , xD(1))→(z1
(1) , z2(1) , ... , zd
(1))
...(x1
(n) , x2(n) , ... , xD
(n))→(z1(n) , z2
(n) , ... , zd(n))
The vector
is called the i-th principal component (of the data set)
(z i(0) , zi
(1) , ... , z i(n))
![Page 11: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/11.jpg)
PCA Goals – 2
Of course many possible transformations possible... Reducing the number of variables: loss of information PCA makes this loss minimal
PCA is very useful Exploratory analysis of the data Visualization of high-D data Data preprocessing Data compression
![Page 12: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/12.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
(what variable contains the most information?)
x1
x2
![Page 13: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/13.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
(what variable contains the most information?)
x1
x2
Very important idea
The most information is contained by the variable with the largest spread.
● i.e., highest variance
(Information Theory)
![Page 14: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/14.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
(what variable contains the most information?)
x1
x2
so if we have to chose between x
1 and x
2
→ remember x2
Transform of k-th point:
where
(x1(k) , x2
(k ))→(z1(k))
z1(k )=x2
(k )
Very important idea
The most information is contained by the variable with the largest spread.
● i.e., highest variance
(Information Theory)
![Page 15: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/15.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
(what variable contains the most information?)
x1
x2
so if we have to chose between x
1 and x
2
→ remember x2
Transform of k-th point:
where
(x1(k) , x2
(k ))→(z1(k))
z1(k )=x2
(k )
Example:
z1(k )=1.5
![Page 16: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/16.jpg)
PCA – Intuition
Reconstruction based on x2
→ only need to remember mean of x1
x1
x2
![Page 17: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/17.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2
![Page 18: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/18.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2
This is a projection on the x1 axis.
![Page 19: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/19.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2
![Page 20: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/20.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2
● More difficult......projection on both axes does not give nice results.
● Idea of PCA: find a new direction to project on!
![Page 21: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/21.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2
● More difficult......projection on both axes does not give nice results.
● Idea of PCA: find a new direction to project on!
![Page 22: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/22.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2
u is the direction of highest variance
u
![Page 23: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/23.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2Transform of k-th point:
where z1 is the
orthogonal scalar projection on u:
(x1(k) , x2
(k ))→(z1(k))
z1(k )=u1 x1
(k)+u2 x2(k)=(u , x(k))
u
![Page 24: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/24.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2Transform of k-th point:
where z1 is the
orthogonal scalar projection on u:
(x1(k) , x2
(k ))→(z1(k))
z1(k )=u1 x1
(k)+u2 x2(k)=(u , x(k))
uNote, the general formula for scalar
projection is
However, when u is a unit vector, we can use the simplified formula
(u , x(k ))/(u ,u)
![Page 25: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/25.jpg)
PCA – Intuition
How would you summarize this data using 1 dimension?
x1
x2Transform of k-th point:
where z1 is the
orthogonal scalar projection on u:
(x1(k) , x2
(k ))→(z1(k))
z1(k )=u1 x1
(k)+u2 x2(k)=(u , x(k))
u
E.g.:
is the first principal component of this data point
z1=0.7(−0.7)+0.7(−.5)=−0.84
-0.7
-0.5
![Page 26: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/26.jpg)
PCA – Intuition
PCA so far...
find the direction uof highest variance
project data on u → z1
the first principle component (PC)
Next...
find more directions of high variance→ u is u(1), the direction of the first PC→ find u(2), u(3),..., u(D) (the directions of the other PCs)
x1
x2
u
![Page 27: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/27.jpg)
More Principle Components
Given this data, what is u(1) ?(i.e., the direction of the first PC)
x1
x2
![Page 28: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/28.jpg)
More Principle Components
u(1) explains the most variance What is u(2)?
(the direction of the 2nd PC) ?
x1
x2
![Page 29: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/29.jpg)
More Principle Components
u(2) is the direction with most 'remaining' variance orthogonal to u(1) !
Data is 2D, so can find only two directions
Each point x(k) can be converted to z(k)
(x1(k) , x2
(k ))⇔(z1(k) , z2
(k))
z i(k )=(u(i) , x(k ))
x1
x2
![Page 30: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/30.jpg)
Floating Point Numbers
![Page 31: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/31.jpg)
How are number represented?
Matlab represents numbers using a floating point representation
(−1)⋅(0.b1b2 ...b53)⋅2e
signmantissa●53 bits - 253=9.0072e+15●normalized: b
1 ~= 0
(unique representation)
Exponent-1021< e < 1024
![Page 32: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/32.jpg)
How are number represented?
Matlab represents numbers using a floating point representation
Smallest normalized non-norm.
Largest
(−1)⋅(0.b1b2 ...b53)⋅2e
signExponent-1021< e < 1024
(0.100 ...00)⋅2−1021=2.2251e-308
(0.000 ...01)⋅2−1021=4.9407e-324
(0.111...11)⋅21024=1.7977e+308
mantissa●53 bits - 253=9.0072e+15●normalized: b
1 ~= 0
(unique representation)
![Page 33: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/33.jpg)
Spacing between numbers
Spacing for the largest numbers
Spacing for smallest numbers 4.9407e-324
“eps(n)” gives spacing around n eps(realmax), eps(0)
diff =(0.000...001)⋅21024=1⋅2(1024−53)
=1.9958e+292
(0.000...001)⋅21024
(0.000...010)⋅21024
![Page 34: Week 2people.csail.mit.edu/fao/docs/SciComp13/SC-2-slides.pdf · Scientific Computing Maastricht Science Program Week 2 Frans Oliehoek](https://reader036.fdocuments.us/reader036/viewer/2022071006/5fc3bea629ae574dda65ea2a/html5/thumbnails/34.jpg)
Round Off Errors
set of floating point numbers F when real number x is replaced by number fl(x) in F
→ round off error
Absolute error can be large: 0.5 *eps(realmax)
However: relative error is bounded where
∣x−fl(x)∣∣x∣
⩽12ϵ
ϵ=eps (1)=2.2204e-16