Week 7
Week 7
Machine Learning
Week 7
*pythonprogramming.net
Machine Learning?
Machine Learning?
horse
car
Natural Language Processing
Nineteen Eighty-Four
by George Orwell
(1984)
[...]
Politics
BIG BROTHER Propaganda
IS WATCHING
YOU, the caption
Privacy
said, while the
dark eyes looked
deep into
Winston's own
[...]
Whodunit!
Image recognition
horse
car
Machine Learning algorithms
Training
inputs data outputs
Machine Learning algorithms
Training
data horse
Image Classification
0
1
2
3
4
5
6
7
8
9
Handwritten digit classification
Training 0
data
0
1
6
2
3
4
5
6
7
8
9
Nearest
Neighbor Minimal
Classifier distance
0 00 ? 6 66
Labeled training set Test point
Nearest
Neighbor 6
Classifier 6
? 6
0 6
0 Minimal
0 distance
*www.wikipedia.com
Flatland, Edwin Abbott Abbott, 1984
https://vimeo.com/8675372
*www.wikipedia.com
Ready to go beyond
Lineland, Flatland, and
Spaceland?
?
0 0 5 13 9 1 0 0
0 0 13 15 10 15 5 0
0 3 15 2 0 11 8 0
0 4 12 0 0 8 8 0
0 5 8 0 0 9 8 0
0 4 11 0 1 12 7 0
0 2 14 5 10 12 0 0
0 0 6 13 10 0 0 0
0 0 5 13 9 1 0 0
0 0 13 15 10 15 5 0
0 3 15 2 0 11 8 0
0 4 12 0 0 8 8 0
0 5 8 0 0 9 8 0
0 4 11 0 1 12 7 0
0 2 14 5 10 12 0 0
0 0 6 13 10 0 0 0
64 dimensional space
Nearest
Neighbor
Classifier
6
6
? 6
0 6
0 dist( , )
0
x = [1, 1]
y = [3, 4]
x - y = [-2, -3]
(x - y)**2 = [4, 9]
np.sum((x - y)**2) = 13
np.sqrt(np.sum((x - y)**2)) = 3.60
0
1
2
3 Labeled
4
5 training
6
7
set
8
9
0
6
~ 97% Correct
The CIFAR-10 dataset
airplane
automobile
bird
cat Labeled
deer training set
dog
frog
horse www.kaggle.com
ship
truck
*http://www.cs.toronto.edu/~kriz/cifar.html
With Nearest Neighbor Classifier
horse
car
~ 30% Correct
Training set for category ‘0’:
*http://cs231n.github.io
Features
0 0 5 13 9 1 0 0
0 0 13 15 10 15 5 0
0 3 15 2 0 11 8 0
0 4 12 0 0 8 8 0
0 5 8 0 0 9 8 0
0 4 11 0 1 12 7 0
0 2 14 5 10 12 0 0
0 0 6 13 10 0 0 0
Features
(, , ,)
Deep
Learning
*http://www.slideshare.net/roelofp/220115dlmeetup
Tensorflow Deep dream generator
https://www.tensorflow.org http://deepdreamgenerator.com
The CIFAR-10 dataset
airplane
automobile
bird
cat Labeled
deer training set
dog
frog
horse
ship
truck
*http://www.cs.toronto.edu/~kriz/cifar.html
With Deep Learning...
horse
car
~ 95% Correct
Is 95% enough?
MAY 2016
http://wapo.st/2981upr
“Neither Autopilot nor the driver noticed the white side
of the tractor trailer against a brightly lit sky, so the
brake was not applied”
*www.tesla.com
Challenges
*http://cs231n.github.io
Text Clustering
Text clustering
k=2
https://docs.google.com/spreadsheets/d/1udJ4nd9EKlX_awB90JCbKaStuYh6aVjh1X6j8iBUXIU/edit#gid=0
k=2 Unlabeled data
K-means
k=2 Unlabeled data
K-means
Robin Hood
Told with animals for it's
cast, the story tells of
? Robin Hood
Robin Hood (a fox) and
Little John (a brown
bear), who rob from the
rich to give to the poor.
[...]
Unlabeled data
k=2
A Beautiful Mind
The Matrix
Aladdin The King's Speech
Robin Hood
Finding Nemo
K-means
Something simpler...
a) I love CS50. Staff is
awesome, awesome,
awesome!
CLUSTER 1:
b) I have a dog and a cat.
a) c)
c) Best of CS50? Staff.
And cakes. Ok, CS50 staff. CLUSTER 2:
b) d)
d) My dog keeps chasing my
cat. Dogs!
k=2
k=2
b) I have a dog and a cat.
K-means
a) I love CS50. Staff is
awesome, awesome,
? a) I love CS50. Staff is
awesome, awesome,
awesome!
awesome!
a) I love CS50. Staff is awesome, awesome, awesome!
b) I have a dog and a cat.
c) Best of CS50? Staff. And cakes. Ok, CS50 staff.
Bags of
d) My dog keeps chasing my cat. Dogs! words
awesome best cakes cat chasing cs50 dog dogs keeps love ok staff
a) 3 0 0 0 0 1 0 0 0 1 0 1
b) 0 0 0 1 0 0 1 0 0 0 0 0
c) 0 1 1 0 0 2 0 0 0 0 1 2
d) 0 0 0 1 1 0 1 1 1 0 0 0
a) I love CS50. Staff is awesome, awesome, awesome!
b) I have a dog and a cat.
c) Best of CS50? Staff. And cakes. Ok, CS50 staff.
d) My dog keeps chasing my cat. Dogs!
Frequency
awesome best cakes cat chasing cs50 dog dogs keeps love ok staff
12 dimensional space
k=2
b) I have a dog and a cat.
K-means
Python code
(Unsupervised Learning)
Recap
Handwritten digit classification
0
6
Text clustering
k=2
https://docs.google.com/spreadsheets/d/1udJ4nd9EKlX_awB90JCbKaStuYh6aVjh1X6j8iBUXIU/edit#gid=0
Machine Learning?
# #
## ##
### ###
#### ####
##### #####
###### ######
####### #######
Machine Learning… so much more
MARCH 2016
“Commentators were convinced [AlphaGo]
had made mistakes, but as it racked up
wins, they were forced to concede that
perhaps the machine [...] was using
strategies its human masters had
simply overlooked.”
https://www.youtube.com/watch?v=JNrXgpSEEIE&t=0m30s