Machine Learning 1 Week 1 Lecture PDF

Summary

This document is a set of lecture notes on machine learning, focusing on general machine learning concepts. The presentation details classifications of machine learning and gives examples.

Full Transcript

Machine Learning 1 Week 1 - Lecture b Agenda Course Introduction Supervised Machine Learning Course Introduction Book https://www.statlearning.com/ Optional Textbook Course Tour Syllabus Course Site Course Outline Da...

Machine Learning 1 Week 1 - Lecture b Agenda Course Introduction Supervised Machine Learning Course Introduction Book https://www.statlearning.com/ Optional Textbook Course Tour Syllabus Course Site Course Outline Data Camp Supervised Machine Learning What is Supervised Machine Learning, and Why Do We Use it? Is this a Tree? Learning from Data Learning from Data The learning algorithm will discover the patterns, build the rules, and create a model The learning is done by making small, iterative adjustments The learned model represents a decision boundary Biologically Inspired https://rednuht.org/genetic_cars_2/ Neural Network https://playground.tensorflow.org/ Learning by Trial and Error Image source: https://www.gettingready4baby.org/playing Machine Learning Arthur Samuel (1959). Machine Learning: Field of study that gives computers the ability to learn without being explicitly programmed. Machine Learning Herb Simon (1978). Machine Learning is concerned with computer programs that automatically improve their performance through experience. Machine Learning Tom Mitchell (1997). A computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E. Task T : Performance measure P : Training experience E: ad Artificial Intelligence Alan Turing (1950). Computing Machinery and Intelligence The Imitation Game, “Can machines think?”. Image https://blog.sciencemuseum.org.uk/the-multiple-lives-of-alan- Source turing/ The Turing Test A conversation where a physical barrier separates you, passing notes back and forth. If you cannot identify that you are speaking with a machine, that machine is intelligent. https://www.cnn.com/2024/11/27/health/video/ai- illness-diagnosis-study-rodman-intv-ebof-digvid Source https://www.cnn.com/2023/01/26/tech/chatgpt-passes-exams/index.html Artificial Intelligence Image https://www.worldscientific.com/doi/pdf/10.1142/9789811228155_0001 Source http://jmc.stanford.edu/articles/dartmouth/dartmouth.pdf Artificial Intelligence & Games Ken Jennings vs. Arthur Samuel IBM Watson Checkers (1959) Jeopardy (2011) Garry Kasparov AlphaGo vs. Lee vs. Deep Blue Sedol - Go (2016) Chess (1997) Why Now? More Data Increased Computational Power Progress on algorithms, theory & tools Accessible Computing Categories of Machine Learning Labeled data Supervised Learning Direct feedback Predict outcome/future Supervised Learning: Regression y x Supervised Learning: Classification x2 x1 Categories of Machine Learning Labeled data Supervised Learning Direct feedback Predict outcome/future No labels/targets Unsupervised Learning No feedback Find hidden structure in data Unsupervised Learning -- Clustering x2 x1 Categories of Machine Learning Labeled data Supervised Learning Direct feedback Predict outcome/future No labels/targets Unsupervised Learning No feedback Find hidden structure in data Decision process Reinforcement Learning Reward system Learn series of actions Reinforcement Learning Environment Reward State Action Agent Supervised Machine Learning Regression tasks: when the output is a continuous variable. Classification tasks: when the output is a discrete variable. Supervised Machine Learning Use training examples to estimate a function 𝑓መ that 𝑥1 Unknown target function captures the relationship 𝑓: between the inputs and Input variables 𝑥2 y = 𝑓 𝑥1 , 𝑥2 , … 𝑥𝑝 + 𝜖 output. where 𝜖 is random error Observed: 𝑦.. Learning Algorithm A Predicted: 𝑦ො. Estimated function 𝑓: መ Goal is to use Learning 𝑥𝑝 𝑦ො = 𝑓መ 𝑥1 , 𝑥2 , … 𝑥𝑝 Algorithm A to infer a function 𝑓መ that can predict the output 𝑦ො Source accurately given new inputs. Abu-Mostafa, Y. S., Magdon-Ismail, M., & Lin, H. T. (2012). Learning from data (Vol. 4). New York, NY, USA: AMLBook. Supervised Machine Learning The algorithm learns to predict output given input by observing training examples in the form of pairs. The algorithm performance is measured based on how well the model predicts the outcome on test examples. The goal to for the model to perform well on new unseen examples. This is known as generalization. Supervised Machine Learning obs. X Y 1 5.0 217.4 2 9.7 184.2 3 14.5 188.3 Training examples 4 19.2 189.5 5 23.9 218.0 6 28.7 230.8 7 33.4 263.9 8 38.2 293.0 9 42.9 304.2 10 47.6 325.9 11 52.4 343.0 12 57.1 337.8 13 61.8 347.2 14 66.6 336.9 15 71.3 343.3 16 76.1 329.3 17 80.8 337.1 18 85.5 348.3 19 90.3 355.2 20 95.0 392.1 Test examples 21 7.0 204.3 22 16.3 235.5 23 25.7 242.5 24 35.0 272.4 25 44.3 283.8 26 53.7 279.7 27 63.0 335.8 28 72.3 342.0 29 81.7 356.8 30 91.0 388.2 We can use training examples (shown in red) to learn the relationship between input variable 𝑋 and output variable 𝑌. Our goal is to use the learned relationship to accurately predict 𝑌 for the test examples (shown in blue). Can you think of classification problems? Classification Many predictive problems are framed as binary classification problems. Will this customer leave us if the price of oil drops below X? Will this unit fail in the next 30 days? Will this construction site run out of fuel tomorrow? Is this a fraudulent transaction? Does this X-ray image represent a patient with Pneumonia? – Will this customer default on a loan? – Will this image trigger a person to click on my offer? Can you think of regression problems? Regression How much? Prices How many? Retweets How can we evaluate regression and classification models? Evaluating a Regression Model For continuous output, the quality of a model 𝑓መ may be measured by the mean squared error: 1 𝑛 2 𝑀𝑆𝐸 = σ𝑖=1 𝑦𝑖 − 𝑓መ 𝑥𝑖 , where 𝑓መ 𝑥𝑖 is the predicted 𝑛 value that 𝑓መ returns for observation 𝑖. Evaluating a Regression Model Regression Model Overfitting The Bias Variance Tradeoff Simpler models are less able to detect relationships between input features and prediction labels. High bias Low Variance Underfitting Complex models can be sensitive to noise and may not generalize well to new unseen examples. Low Bias High Variance Overfitting Evaluating a Classification Model For classification problems, the quality of a model 𝑓መ may be measured by the proportion of correctly classified observations (accuracy) and the expected cost of misclassification (estimated from its confusion matrix). 𝐶𝑜𝑟𝑟𝑒𝑐𝑡 𝑃𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑜𝑛𝑠 Accuracy = 𝑇𝑜𝑡𝑎𝑙 𝑂𝑏𝑠𝑒𝑟𝑣𝑎𝑡𝑖𝑜𝑛𝑠 Evaluating a Classification Model We are more interested in evaluating the accuracy of the model on the test set than the training set. The test accuracy is a better indicator of the ability of the model to generalize to new unseen examples. Note that accuracy can provide a misleading measure of the quality of a predictive model for an imbalanced dataset. Evaluating a Classification Model Evaluation should be based on test samples that are not used for training the model. TP: Positive example predicted as positive FN: Positive example predicted as negative FP: Negative example predicted as positive TN: Negative example predicted as negative Predicted Positive Negative Positive TP FN Actual Negative FP TN Confusion Matrix Evaluating a Classification Model The Decision Boundary is a threshold (t) that can be moved to bias a classifier towards a class (positive or negative) Evaluating a Classification Model If I asked you predict how many published papers will win a noble prize and you predicted no to all papers, what do you think the impact is on the accuracy of your prediction model? 𝐶𝑜𝑟𝑟𝑒𝑐𝑡 𝑃𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑜𝑛𝑠 Accuracy = 𝑇𝑜𝑡𝑎𝑙 𝑂𝑏𝑠𝑒𝑟𝑣𝑎𝑡𝑖𝑜𝑛𝑠 ROC Curve for Classifier Evaluation Structure of Training and Prediction Split data: X_train, y_train; X_test; y_test = splitData(X, y) Create model: model = modelName(parameters) Train model: model.fit(X_train, y_train) where: x_train: inputs for training examples, y_train: outputs for training examples Predict with trained model on test examples: y_predicted = model.predict(X_test) where: x_test: inputs for examples to predict Check predictive accuracy of trained model on test examples: accuracy_score(y_test, y_predicted) where: y_test: correct outputs for predicted examples

Use Quizgecko on...
Browser
Browser