Machine Learning Abel Sanchez John Williams Machine Learning

Machine Learning Abel Sanchez, John Williams

Machine Learning (Practical Definition) • Start with data • Learn a model from data, identify a pattern in data • Use pattern to gain insight

Examples • Prediction – e. g. Is this transaction fraudulent? • Prediction – e. g. Will user click on link? • Exploration – e. g. Processing larger numbers of documents • Exploration – e. g. Visualization patterns

Your Life is Impacted by ML • • • What adds you are shown What news articles you are offered Other shoppers like you bought … E-dating Security screening. . .

Linear Regression

Least Squares d 4 D = (d 1)2 + (d 2)2 + (d 3)2 + (d 4)2 Best linear model will have the smallest sum of distances squared (D) d 3 d 1 d 2

Linear Regression Slope Intercept Regression Equation Line

Active Learning • Write a function to create the linear regression equation …


K-Means

Algorithm 1. Place K points into the space represented by the objects. These points represent initial group centroids. 2. Assign each object to the group that has the closest centroid. 3. When all objects have been assigned, recalculate the positions of the K centroids. 4. Repeat Steps 2 and 3 until the centroids no longer move.

K-Means Algorithm start add k points (initial centroids) Assign each point to closest centroid Group based on assigned centroid Recalculate k centroids yes no Centroid movement end

Visualization

progress values 0 – to – 1 Start x 1 , y 1 xi = x 1 + (x 2 – x 1) progress yi = y 1 + (y 2 – y 1) progress xi, yi y 2 – y 1 x 2 , y 2 End progress x 2 – x 1

You have x 1, y 1 and x 2, y 2 - Find yi given xi Slope, m = (y 2 – y 1)/(x 2 – x 1) Start Substitute xi, yi for x 2, y 2 x 1 , y 1 The equation is: y = y 1 + m(x – x 1) y 2 – y 1 yi x 2 , y 2 xi progress x 2 – x 1 End

Active Learning • Write an implementation of K-Means …

- Slides: 17