Machin ine Learnin ing Basic ics I2DL: Prof. Niessner, Prof. Leal-Taixé 1
Machin ine Learn rning Task I2DL: Prof. Niessner, Prof. Leal-Taixé 2
Im Image Cla lassific ication I2DL: Prof. Niessner, Prof. Leal-Taixé 3
Appearance Illumination Pose I2DL: Prof. Niessner, Prof. Leal-Taixé 4
Im Image Cla lassific ication Occlusions I2DL: Prof. Niessner, Prof. Leal-Taixé 5
Im Image Cla lassific ication Background clutter I2DL: Prof. Niessner, Prof. Leal-Taixé 6
Im Image Cla lassific ication Representation I2DL: Prof. Niessner, Prof. Leal-Taixé 7
Machin ine Learn rning • How can we learn to perform image classification? Task Experience Image Data classification I2DL: Prof. Niessner, Prof. Leal-Taixé 8
Machin ine Learn rning Unsupervised learning Supervised learning No label or target class • Find out properties of • the structure of the data • Clustering (k-means, PCA, etc.) I2DL: Prof. Niessner, Prof. Leal-Taixé 9
Machin ine Learn rning Unsupervised learning Supervised learning I2DL: Prof. Niessner, Prof. Leal-Taixé 10
Machin ine Learn rning Unsupervised learning Supervised learning Labels or target classes • I2DL: Prof. Niessner, Prof. Leal-Taixé 11
Machin ine Learn rning Unsupervised learning Supervised learning CAT DOG DOG CAT CAT DOG I2DL: Prof. Niessner, Prof. Leal-Taixé 12
Machin ine Learn rning • How can we learn to perform image classification? Experience Underlying assumption that train and test data come Training data Test data Data from the same distribution I2DL: Prof. Niessner, Prof. Leal-Taixé 13
Machin ine Learn rning • How can we learn to perform image classification? Task Experience Performance Image Data measure classification Accuracy I2DL: Prof. Niessner, Prof. Leal-Taixé 14
Machin ine Learn rning Unsupervised learning Supervised learning Reinforcement learning interaction Agents Environment I2DL: Prof. Niessner, Prof. Leal-Taixé 15
Machin ine Learn rning Unsupervised learning Supervised learning Reinforcement learning reward Agents Environment I2DL: Prof. Niessner, Prof. Leal-Taixé 16
Machin ine Learn rning Unsupervised learning Supervised learning Reinforcement learning reward Agents Environment I2DL: Prof. Niessner, Prof. Leal-Taixé 17
A Sim imple le Cla lassif ifie ier I2DL: Prof. Niessner, Prof. Leal-Taixé 18
Neare rest Neig ighbor ? I2DL: Prof. Niessner, Prof. Leal-Taixé 19
Neare rest Neig ighbor NN classifier = dog distance I2DL: Prof. Niessner, Prof. Leal-Taixé 20
Neare rest Neig ighbor k-NN classifier = cat distance I2DL: Prof. Niessner, Prof. Leal-Taixé 21
Neare rest Neig ighbor The Data NN Classifier 5NN Classifier How does the NN classifier perform on training data? What classifier is more likely to perform best on test data? Source: https://commons.wikimedia.org/wiki/File:Data3classes.png I2DL: Prof. Niessner, Prof. Leal-Taixé 22
Neare rest Neig ighbor L1 distance : |𝑦 − 𝑑| • Hyperparameters L2 distance : ||𝑦 − 𝑑|| 2 No. of Neighbors: 𝑙 • These parameters are problem dependent. • How do we choose these hyperparameters? I2DL: Prof. Niessner, Prof. Leal-Taixé 23
Basic Recip ipe fo for r Machine Learning • Split your data 20% 20% 60% train test validation Find your hyperparameters Other splits are also possible (e.g., 80%/10%/10%) I2DL: Prof. Niessner, Prof. Leal-Taixé 24
Basic Recip ipe fo for r Machine Learning • Split your data 20% 20% 60% train test validation Find your hyperparameters Test set is only used once! I2DL: Prof. Niessner, Prof. Leal-Taixé 25
Cro ross Valid idation train Run 1 validation Run 2 Run 3 Run 4 Run 5 Split the tra train ining data ta into N folds I2DL: Prof. Niessner, Prof. Leal-Taixé 26
Cro ross Valid idation 20% 20% 60% train test validation Why do cross Find your hyperparameters validation? Why not just train and test? I2DL: Prof. Niessner, Prof. Leal-Taixé 27
Cro ross Valid idation 20% 20% 60% train test validation Why do cross Find your hyperparameters validation? Why Test set is only used once! not just train and test? I2DL: Prof. Niessner, Prof. Leal-Taixé 28
Lin inear Decis isio ion Boundarie ies This lecture What are the pros and cons for using linear decision boundaries? I2DL: Prof. Niessner, Prof. Leal-Taixé 32
Lin inear Regressio ion I2DL: Prof. Niessner, Prof. Leal-Taixé 33
Lin inear Regression Supervised learning • Find a linear model that explains a target 𝒛 given • inputs 𝒚 𝒛 𝒚 I2DL: Prof. Niessner, Prof. Leal-Taixé 34
Lin inear Regression Training {𝒚 1:𝑜 , 𝒛 1:𝑜 } Learner 𝜾 Model parameters Data points Input (e.g., image, Labels measurement ) (e.g., cat/dog) I2DL: Prof. Niessner, Prof. Leal-Taixé 35
Lin inear Regression can be parameters of a Training Neural Network {𝒚 1:𝑜 , 𝒛 1:𝑜 } Learner 𝜾 Model parameters Data points Testing 𝑦 𝑜+1 , 𝜾 𝑧 𝑜+1 ො Predictor Estimation I2DL: Prof. Niessner, Prof. Leal-Taixé 36
Lin inear Pre rediction • A linear model is expressed in the form input dimension 𝑒 𝑧 𝑗 = ො 𝑦 𝑗𝑘 𝜄 𝑘 𝑘=1 weights (i.e., model parameters) Input data, features I2DL: Prof. Niessner, Prof. Leal-Taixé 37
Lin inear Pre rediction • A linear model is expressed in the form 𝑒 𝑧 𝑗 = 𝜄 0 + ො 𝑦 𝑗𝑘 𝜄 𝑘 = 𝜄 0 + 𝑦 𝑗1 𝜄 1 + 𝑦 𝑗2 𝜄 2 + ⋯ + 𝑦 𝑗𝑒 𝜄 𝑒 𝑘=1 𝒛 bias 𝜄 0 𝒚 I2DL: Prof. Niessner, Prof. Leal-Taixé 38
Lin inear Pre rediction Outside Number of 𝑦 3 𝑦 1 𝜄 1 𝜄 3 temperature people Temperature of a building 𝜄 2 𝜄 4 Sun Level of 𝑦 2 𝑦 4 exposure humidity I2DL: Prof. Niessner, Prof. Leal-Taixé 39
Lin inear Pre rediction 𝑦 11 𝑦 1𝑒 ⋯ 𝑧 1 ො 𝜄 1 𝑦 21 ⋯ 𝑦 2𝑒 𝜄 2 𝑧 2 ො = 𝜄 0 + ∙ ⋮ ⋱ ⋮ ⋮ ⋮ 𝑦 𝑜1 ⋯ 𝑦 𝑜𝑒 𝑧 𝑜 ො 𝜄 𝑒 𝑦 11 𝑦 1𝑒 ⋯ 𝑧 1 ො 𝜄 0 1 𝑦 21 𝑦 2𝑒 ⋯ 𝜄 1 𝑧 2 ො 1 ֜ ො 𝐳 = 𝐘𝜾 = ⋮ ⋱ ⋮ ⋮ ⋮ ⋮ 𝑦 𝑜1 ⋯ 𝑦 𝑜𝑒 1 𝜄 𝑒 𝑧 𝑜 ො I2DL: Prof. Niessner, Prof. Leal-Taixé 40
Lin inear Pre rediction Input features ො 𝐳 = 𝐘𝜾 Prediction (one sample has 𝑒 features) 𝑦 11 𝑦 1𝑒 ⋯ 𝑧 1 ො 𝜄 0 1 𝑦 21 𝑦 2𝑒 ⋯ 𝜄 1 𝑧 2 ො 1 = Model ⋮ ⋱ ⋮ ⋮ ⋮ ⋮ 𝑦 𝑜1 ⋯ 𝑦 𝑜𝑒 parameters 1 𝑧 𝑜 ො 𝜄 𝑒 (𝑒 weights and 1 bias) I2DL: Prof. Niessner, Prof. Leal-Taixé 41
Lin inear Pre rediction Temperature MODEL of the building 0.2 0.64 𝑧 1 ො 1 25 50 2 50 = ⋅ 0 𝑧 2 ො 0 1 − 10 50 10 1 0.14 I2DL: Prof. Niessner, Prof. Leal-Taixé 42
Lin inear Pre rediction How ow do o we obtain ob in th the mod odel? Temperature MODEL of the building 0.2 0.64 𝑧 1 ො 1 25 50 2 50 = ⋅ 0 𝑧 2 ො 0 1 − 10 50 10 1 0.14 I2DL: Prof. Niessner, Prof. Leal-Taixé 43
How to Obtain in the Model? Labels (ground truth) Data points 𝑧 𝐘 Optimization Loss function Estimation Model parameters 𝜄 𝑧 ො I2DL: Prof. Niessner, Prof. Leal-Taixé 44
How to Obtain in the Model? • Loss fu functio ion: measures how good my estimation is (how good my model is) and tells the optimization method how to make it better. • Opti timizatio ion: : changes the model in order to improve the loss function (i.e., to improve my estimation). I2DL: Prof. Niessner, Prof. Leal-Taixé 45
Lin inear Regression: : Loss Functio ion Prediction: Temperature of the building I2DL: Prof. Niessner, Prof. Leal-Taixé 46
Lin inear Regression: : Loss Functio ion Prediction: Temperature of the building I2DL: Prof. Niessner, Prof. Leal-Taixé 47
Lin inear Regression: : Loss Functio ion Objective function 𝑜 𝐾 𝜾 = 1 Minimizing 𝑧 𝑗 − 𝑧 𝑗 2 Energy 𝑜 ො Cost function 𝑗=1 I2DL: Prof. Niessner, Prof. Leal-Taixé 48
Optim imization: : Lin inear Least Squares • Linear least squares: an approach to fit a linear model to the data 𝑜 𝐾 𝜾 = 1 𝑧 𝑗 − 𝑧 𝑗 2 min 𝑜 ො 𝜄 𝑗=1 • Convex problem, there exists a closed-form solution that is unique. I2DL: Prof. Niessner, Prof. Leal-Taixé 49
Optim imization: : Lin inear Least Squares 𝑜 𝑜 𝐾 𝜾 = 1 = 1 𝑧 𝑗 − 𝑧 𝑗 2 𝐲 𝑗 𝜾 − 𝑧 𝑗 2 min 𝑜 ො 𝑜 𝜾 𝑗=1 𝑗=1 The estimation comes 𝑜 training samples from the linear model I2DL: Prof. Niessner, Prof. Leal-Taixé 50
Optim imization: : Lin inear Least Squares 𝑜 𝑜 𝐾 𝜾 = 1 𝑧 𝑗 − 𝑧 𝑗 2 = 1 𝐲 𝑗 𝜾 − 𝑧 𝑗 2 min 𝑜 ො 𝑜 𝜾 𝑗=1 𝑗=1 𝐾 𝜾 = 𝐘𝜾 − 𝒛 𝑈 (𝐘𝜾 − 𝒛) Matrix notation min 𝜾 𝑜 labels 𝑜 training samples, each input vector has size 𝑒 I2DL: Prof. Niessner, Prof. Leal-Taixé 51
Recommend
More recommend