CS50 Machine Learning

Transcription

CS50Machine LearningWeek 7

*pythonprogramming.net

Machine Learning?

Machine tionNaturalLanguageProcessing

inputsoutputs

Image Recognitionhorsecar

Natural Language ProcessingNineteen Eighty-Fourby George Orwell(1984)[.]BIG BROTHERIS WATCHINGYOU, the captionsaid, while thedark eyes lookeddeep intoWinston's own[.]PoliticsPropagandaPrivacy

Whodunit!Image recognitionhorsecar

Machine Learning algorithmsinputsTrainingdataoutputs

Machine Learning algorithmsTrainingdatahorse

Image Classification

0123456789

Handwritten digit classificationTrainingdata012345678906

NearestNeighborClassifierMinimaldistance0 00? 6 66Labeled training setTest point

led training setTest point66

?

beled training setTest point

?

Flatlandby Edwin Abbott Abbott(1884)*www.wikipedia.com

Flatland, Edwin Abbott Abbott, 1984Flatland: The story describes a two-dimensional world occupied bygeometric figures. The narrator is a square named A Square who guides thereaders through some of the implications of life in two dimensions.On New Year's Eve, A Square dreams about a visit to a one-dimensionalworld (Lineland) inhabited by "lustrous points", in which he attempts to convincethe realm's monarch of a second dimension; but is unable to do so.Following this vision, A Square is himself visited by a three-dimensionalsphere named A Sphere, which he cannot comprehend until he sees Spaceland(a tridimensional world)https://vimeo.com/8675372*www.wikipedia.com

Ready to go beyondLineland, Flatland, andSpaceland?

?

01151189121200588870000000000

0115118912120058887000000000064 dimensional space

NearestNeighborClassifier?0060dist(Labeled training set6,66)Test point

78167000591210000000000)) 31.98

024641041316161616154141410716913135 0 00 0 00 0 00 0 015 4 04 16 26 16 1116 15 500000000)) 45.97

The digits dataset0123456789Labeledtrainingset

Python code(Supervised Learning)

np.sqrt(np.sum((x - y)**2)) ?xyx(x -[1, 1][3, 4]y [-2, -3]y)**2 [4, 9]np.sum((x - y)**2) 13np.sqrt(np.sum((x - y)**2)) 3.60

0123456789LabeledTraining subsetLabeledtrainingsetTest point

0123456789LabeledTraining setTesting set

0123456789LabeledTraining setTesting set

With Nearest Neighbor Classifier06 97% Correct

The CIFAR-10 iptruckLabeledtraining setwww.kaggle.com*http://www.cs.toronto.edu/ kriz/cifar.html

With Nearest Neighbor Classifierhorsecar 30% Correct

Training set for category ‘0’:Training set for category ‘horse’:

Challenges*http://cs231n.github.io

0000110101151189121200588870000000000

Features(, , ,)

115dlmeetup

TensorflowDeep dream mgenerator.com

The CIFAR-10 iptruckLabeledtraining set*http://www.cs.toronto.edu/ kriz/cifar.html

With Deep Learning.horsecar 95% Correct

Is 95% enough?

MAY 2016http://wapo.st/2981upr

“Neither Autopilot nor the driver noticed the white sideof the tractor trailer against a brightly lit sky, so thebrake was not applied”*www.tesla.com

Challenges*http://cs231n.github.io

Text Clustering

Text clusteringIMDB synopses for:- Robin Hood- The Matrix- The King's Speech- Aladdin- A Beautiful Mind- Finding NemoCLUSTER 1:- ?A Beautiful Mind- ?The Matrix- ?The King's SpeechCLUSTER 2:- ?Robin Hood- ?Aladdin- ?Finding Nemok lX awB90JCbKaStuYh6aVjh1X6j8iBUXIU/edit#gid 0

k 2Unlabeled dataK-means

k 2Unlabeled dataK-means

Robin HoodTold with animals for it'scast, the story tells ofRobin Hood (a fox) andLittle John (a brownbear), who rob from therich to give to the poor.[.]?Robin Hood

Unlabeled datak 2A Beautiful MindThe MatrixAladdinThe King's SpeechRobin HoodFinding NemoK-means

Something simpler.a) I love CS50. Staff isawesome, 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 mycat. Dogs!k 2CLUSTER 1:a) c)CLUSTER 2:b) d)

k 2b) I have a dog and a cat.d) My dog keeps chasingmy cat. Dogs!a) I love CS50. Staff isawesome, awesome,awesome!c) Best of CS50? Staff.And cakes. Ok, CS50 staff.K-means

a) I love CS50. Staff isawesome, awesome,awesome!?a) I love CS50. Staff isawesome, awesome,awesome!

a) I love CS50. Staff is awesome, awesome, awesome!Bags ofwordsb) 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!awesome bestcakescat chasing cs50dogdogs keeps 012d)000110111000

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.Frequencyd) My dog keeps chasing my cat. Dogs!awesome bestcakescat chasing cs50dogdogs keeps )01/71/7002/700001/72/7d)0001/51/501/51/51/5000

a) I love CS50. Staff isawesome, awesome,awesome!a) I love CS50. Staff isawesome, awesome,awesome!(3/6, 0, 0, 0, 0, 1/6, 0, 0, 0, 1/6, 0, 1)12 dimensional space

k 2b) I have a dog and a cat.d) My dog keeps chasingmy cat. Dogs!a) I love CS50. Staff isawesome, awesome,awesome!c) Best of CS50? Staff.And cakes. Ok, CS50 staff.K-means

Python code(Unsupervised Learning)

Recap

Handwritten digit classification06

Text clusteringIMDB synopses for:- Robin Hood- The Matrix- The King's Speech- Aladdin- A Beautiful Mind- Finding NemoCLUSTER 1:- A Beautiful Mind- The Matrix- The King's SpeechCLUSTER 2:- Robin Hood- Aladdin- Finding Nemok lX awB90JCbKaStuYh6aVjh1X6j8iBUXIU/edit#gid 0

Machine tionNaturalLanguageProcessing

Machine Learning so much ##########

Machine Learning so much moreMARCH 2016“Commentators were convinced [AlphaGo]had made mistakes, but as it racked upwins, they were forced to concede thatperhaps the machine [.] was usingstrategies its human masters hadsimply overlooked.”Lee Sedolhttps://www.youtube.com/watch?v JNrXgpSEEIE&t 0m30s*www.economist.com

Labeled training set Test point. 0 0 0 6 6 6 6? Minimal distance Labeled training set Test point Nearest Neighbor Classifier? 0 0 0 6 6 6 6? Minimal distance Labeled training set Test point Nearest . Machine Learning so much more *www.economist.com MARCH 2016 "Commentators were convinced [AlphaGo] had made mistakes, but as it racked up