INTRODUCTION TO MACHINE LEARNING Measuring model performance or error
Introduction to Machine Learning Is our model any good? ● Context of task ● Accuracy ● Computation time ● Interpretability ● 3 types of tasks ● Classification ● Regression ● Clustering
Introduction to Machine Learning Classification ● Accuracy and Error ● System is right or wrong ● Accuracy goes up when Error goes down correctly classified instances Accuracy = total amount of classified instances Error = 1 - Accuracy
Introduction to Machine Learning Example ● Squares with 2 features: small/big and solid/do � ed ● Label: colored/not colored ● Binary classification problem
Introduction to Machine Learning Example Truth Predicted ✔ ✘ ✘ ✔ ✔ ✔ ✔ ✔ 3 = = 60% 5 ✔ ✔ ✔ ✘ ✘
Introduction to Machine Learning Example Truth Predicted ✔ ✘ ✘ ✔ ✔ ✔ ✔ ✔ 3 = = 60% 5 ✔ ✔ ✔ ✘ ✘
Introduction to Machine Learning Limits of accuracy ● Classifying very rare heart disease ● Classify all as negative (not sick) ● Predict 99 correct (not sick) and miss 1 ● Accuracy: 99% ● Bogus… you miss every positive case!
Introduction to Machine Learning Confusion matrix ● Rows and columns contain all available labels ● Each cell contains frequency of instances that are classified in a certain way
Introduction to Machine Learning Confusion matrix ● Binary classifier: positive or negative (1 or 0) Prediction P N p TP FN Truth n FP TN
Introduction to Machine Learning Confusion matrix ● Binary classifier: positive or negative (1 or 0) Prediction True Positives P N Prediction: P Truth: P p TP FN Truth n FP TN
Introduction to Machine Learning Confusion matrix ● Binary classifier: positive or negative (1 or 0) Prediction True Negatives P N Prediction: N Truth: N p TP FN Truth n FP TN
Introduction to Machine Learning Confusion matrix ● Binary classifier: positive or negative (1 or 0) Prediction False Negatives P N Prediction: N Truth: P p TP FN Truth n FP TN
Introduction to Machine Learning Confusion matrix ● Binary classifier: positive or negative (1 or 0) Prediction False Positives P N Prediction: P Truth: N p TP FN Truth n FP TN
Introduction to Machine Learning Ratios in the confusion matrix ● Accuracy ● Precision ● Recall Prediction P N p TP FN Truth n FP TN
Introduction to Machine Learning Ratios in the confusion matrix ● Accuracy ● Precision ● Recall Prediction Precision P N TP/(TP+FP) p TP FN Truth n FP TN
Introduction to Machine Learning Ratios in the confusion matrix ● Accuracy ● Precision ● Recall Prediction Precision P N TP/(TP+FP) p TP FN Truth n FP TN
Introduction to Machine Learning Ratios in the confusion matrix ● Accuracy ● Precision ● Recall Prediction Recall P N TP/(TP+FN) p TP FN Truth n FP TN
Introduction to Machine Learning Ratios in the confusion matrix ● Accuracy ● Precision ● Recall Prediction Recall P N TP/(TP+FN) p TP FN Truth n FP TN
Introduction to Machine Learning Back to the squares Prediction P N Truth p 1 1 Truth Predicted n 1 2
Introduction to Machine Learning Back to the squares Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✔
Introduction to Machine Learning Back to the squares Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✔ ✔
Introduction to Machine Learning Back to the squares Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✘
Introduction to Machine Learning Back to the squares Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✘
Introduction to Machine Learning Back to the squares ● Accuracy: (TP+TN)/(TP+FP+FN+TN) = (1+2)/(1+2+1+1) = 60% ● Precision: TP/(TP+FP) = 1/(1+1) = 50% ● Recall: TP/(TP+FN) = 1/(1+1) = 50% Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✔ ✔ ✔
Introduction to Machine Learning Back to the squares ● Accuracy: (TP+TN)/(TP+FP+FN+TN) = (1+2)/(1+2+1+1) = 60% ● Precision: TP/(TP+FP) = 1/(1+1) = 50% ● Recall: TP/(TP+FN) = 1/(1+1) = 50% Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✔ ✘ ✘ ✔ ✔
Introduction to Machine Learning Back to the squares ● Accuracy: (TP+TN)/(TP+FP+FN+TN) = (1+2)/(1+2+1+1) = 60% ● Precision: TP/(TP+FP) = 1/(1+1) = 50% ● Recall: TP/(TP+FN) = 1/(1+1) = 50% Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✘ ✔
Introduction to Machine Learning Back to the squares ● Accuracy: (TP+TN)/(TP+FP+FN+TN) = (1+2)/(1+2+1+1) = 60% ● Precision: TP/(TP+FP) = 1/(1+1) = 50% ● Recall: TP/(TP+FN) = 1/(1+1) = 50% Prediction P N Truth p 1 1 Truth Predicted n 1 2 ✘ ✔
Introduction to Machine Learning Rare heart disease ● Accuracy: 99/(99+1) = 99% ● Recall: 0/1 = 0% ● Precision: undefined — no positive predictions Prediction P N p 0 1 Truth n 0 99
Introduction to Machine Learning Regression: RMSE ● Root Mean Squared Error (RMSE) ● Mean distance between estimates and regression line ● 12 ● ● ● ● ● ● ● 11 ● ● ● ● ● ● ● ● ● 10 ● ● X2 ● ● ● 9 ● ● ● ● ● ● 8 ● ● ● ● ● ● ● ● ● 7 ● ● ● 6 6 7 8 9 10 11 12 X1
Introduction to Machine Learning Clustering ● No label information ● Need distance metric between points
Introduction to Machine Learning Clustering ● Performance measure consists of 2 elements ● Similarity within each cluster ● Similarity between clusters
Introduction to Machine Learning Within cluster similarity ● Within sum of squares (WSS) ● Diameter 10 ● ● ● ● Minimize ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 5 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● X2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● − 5 − 5 0 5 10 X1
Introduction to Machine Learning Between cluster similarity ● Between cluster sum of squares (BSS) ● Intercluster distance 10 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 5 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Maximize ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● X2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● − 5 − 5 0 5 10 X1
Recommend
More recommend