machine learning as a daily work for a programmer- volodymyr vorobiov

208
RUBYGARAGE 2017 TECHNOLOGY MATTERS What It Is And How It Works Machine Learning Volodymyr Vorobiov Software Development Consultant at RubyGarage

Upload: ruby-meditation

Post on 21-Jan-2018

97 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

What It Is And How It Works

Machine Learning

Volodymyr VorobiovSoftware Development Consultant at RubyGarage

Page 2: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

Machine learning is a subset of art i f ic ia l inte l l igence whose goal is to g ive computers the abi l i ty to teach themselves, whereas art i f ic ia l inte l l igence is a general concept of smart machines. In other words, art i f ic ia l inte l l igence is implemented through machine learning or - to be more precise - through machine learning a lgor i thms.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

artificialintelligence

TEACH YOUR COMPUTER

Page 3: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

EXAMPLES OF HOW MACHINE LEARNING IS USED IN THE REAL WORLD

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

- Facia l recognit ion - Voice recognit ion- Text recognit ion- Diagnost ics into medic ine, - Sel f-dr iv ing cars- Robots behavior adjustment- Ads target ing, - Predict ions in f inancia l t rading- Vir tual and augmented real i ty- Astronomy and space ???

Page 4: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

The 21st century is the age of data. I t ’s l i tera l ly everywhere. In fact , there has been an exponent ia l growth in the volume of data over the past decade; the tota l amount of data doubles every two years. Most of i t , however, isn’t used. Huge volumes of data can be tagged, structured, and analyzed, reveal ing a lot of valuable informat ion. Only machine learning a lgor i thms can easi ly cope with th is task.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

WHY THE FUTURE BELONGS TO MACHINE LEARNING

Page 5: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

HOW MACHINE LEARNING WORKS

Preprocessing Learinng Evaluation Prediction

Labels

RawData

Labels

Labels

Final Model New DataTraining Dataset

Test Dataset

LearningAlgorithm

(putting data into the necessary shape)

(creating a model with the help of training data)

(model assessment using test data)

application of the model)

Page 6: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

TOOLS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

- Python - Pandas - Powerful data analysis l ibrary for Python Pandas is a powerful data analysis Python l ibrary that provides flexible and fast data structures for processing “relational” or “labeled” data. This is a fundamental data analysis toolkit in Python. - Scikit-learn - Machine Learning in Python These are simple and effective open-source tools for data mining and analysis. - Statsmodels This is a Python module providing functions and classes to estimate different statistical models as well as to conduct tests and explore statistical data. The Statsmodels module offers a comprehensive l ist of result statistics. - Matplotl ib Matplotl ib is a Python 2D plotting l ibrary that releases publication quality f igures in multiple formats and interactive environments in different platforms.

Page 7: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

The quality of the data and the amount of useful information that itcontains are key factors that determine how well a machine learning algorithm can learn. Therefore, it is absolutely crit ical that we makesure to examine and preprocess a dataset before we feed it to a learning algorithm.- Removing and imputing missing values from the dataset- Getting categorical data into shape for machine learning algorithms- Selecting relevant features for the model construction

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

DATA PREPROCESSING

Page 8: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DATA PREPROCESSING DATASET PRESENTATION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Independent variables Dependent variables

Page 9: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

IMPORTING THE DATASET

Page 10: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

IMPORTING THE DATASET

Page 11: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

DEALING WITH MISSING DATA

Most computat ional tools are unable to handle such missing values or would produce unpredictable results i f we s imply ignored them. Therefore, i t is crucia l that we take care of those missing values before we proceed with further analyses.

Page 12: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

- El iminating samples or features with missing valuesThe easiest solut ion to th is problem is s imply to remove samples with missing values f rom a dataset . However, th is seemingly handy approach has a number of drawbacks. For example, removing too many of such samples is l ike ly to compromise the qual i ty of the analys is .

- Imputing missing valuesThe solut ion is to use var ious interpolat ion techniques that help to “guess” the missing values f rom other samples in a dataset .

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

DEALING WITH MISSING DATA

Page 13: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

IMPUTING MISSING VALUES

Page 14: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

IMPUTING MISSING VALUES RESULTS

Page 15: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

HANDLING CATEGORICAL DATA

Page 16: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ENCODE LABELS

Page 17: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ENCODE LABELS RESULTS

Page 18: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

DUMMY VARIABLES

Page 19: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DUMMY VARIABLES

Page 20: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DUMMY VARIABLES RESULTS

Page 21: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

DUMMY VARIABLE TRAP

Page 22: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

PARTITIONING A DATASET INTO TRAINING AND TEST SETS

Page 23: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

TRAINING AND TEST SETS RESULTS

Page 24: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BRINGING FEATURES ONTO THE SAME SCALE

Page 25: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SAME SCALE RESULTS

Page 26: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

TRAINING AND SELECTING A PREDICTIVE MODEL

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

- Supervised learning - Regression - Classi f icat ion

- Unsupervised learning - Cluster ing - Dimensional i ty Reduct ion

- Reinforcement Learning

- Associat ion Rule Learning

- Natural Language Processing

- Deep Learning

- Model Select ion

Page 27: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SUPERVISED LEARNING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

For making predictions about the future

RegressionFor predict ing cont inuous outcomes

ClassificationFor predict ing c lass labels

Page 28: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Regression models (both linear and non-linear) are used for predicting a real value,

like salary for example. If your independent variable is time,

then you are forecasting future values, otherwise your model is predicting

present but unknown values.

Page 29: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SIMPLE LINEAR REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

y

x

Constant Coefficent

Dependent variable (DV) Independent variable (IV)

y = b + b*x 1 10

Page 30: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DATASET PRESENTATION. EXPERIENCE AND SALARY.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 31: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SIMPLE LINEAR REGRESSION TRAINING

Page 32: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SIMPLE LINEAR REGRESSION TRAINING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 33: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

MULTIPLE LINEAR REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Constant Coefficent

Dependent variable (DV) Independent variable (IVs)

y = b + b*x + b*x ... + b*x1 1 2 2 n n0

Page 34: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DATASET PRESENTATION. INVESTMENT FUND STATISTIC.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 35: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

MULTIPLE LINEAR REGRESSION TRAINING

Page 36: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

EVALUATING REGRESSION MODELS PERFORMANCE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

1. All-in

2. Backward Elimination

3. Forward Selection

4. Bidirectional Elimination

5. Score Comparison

Stepwise

Regression

Page 37: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BACKWARD ELIMINATION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

STEP 1: Select a significance level to stay in the model (e.g. SL = 0.05)

STEP 2: Fit the full model with all possible predictors

STEP 3: Consider the predictor with the highest P-value. If P > SL, go to STEP 4, otherwise go to FIN

STEP 4: Remove the predictor

STEP 5: Fit model without this variable*

Page 38: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BACKWARD ELIMINATION TRAINING

Page 39: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BACKWARD ELIMINATION TRAINING STEP 1

Page 40: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BACKWARD ELIMINATION TRAINING STEP 4

Page 41: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

EVALUATING PERFORMANCE R-SQUARED

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

SUM (y - y^) -> min2

ii

Experience

Simple Linear Regression:Salary ($)

y i

y i

Page 42: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

EVALUATING PERFORMANCE R-SQUARED

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

SS = SUM (y - y^) 2

i ires

SS = SUM (y - y ) 2

i avgtot

y avg

Experience

Simple Linear Regression:Salary ($)

Page 43: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

EVALUATING PERFORMANCE ADJUSTED R-SQUARED

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

p - number of regressorsn - sample size

Page 44: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ADJUSTED R-SQUARED STEP 3

Page 45: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ADJUSTED R-SQUARED STEP 4

Page 46: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ADJUSTED R-SQUARED STEP 5

Page 47: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

POLYNOMIAL REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

y

x

y = b + b x + b x1 1 2 12

0

Page 48: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

POLYNOMIAL REGRESSION. DATASET PRESENTATION.

BLUFFING DETECTOR

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 49: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

POLYNOMIAL REGRESSION. FITTING THE DATASET

Page 50: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

POLYNOMIAL REGRESSION. TRAINING THE MODEL

Page 51: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

POLYNOMIAL REGRESSION RESULTS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 52: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SUPPORT VECTOR REGRESSION BASED ON SUPPORT VECTOR MACHINE

Page 53: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SUPPORT VECTOR REGRESSION. RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 54: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

WHAT IF

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

X1

X2

Page 55: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Split 4

Split 2

Split 1

Split 3200

20 40

170

X1

X2

1023

0.7-64.1300.5

65.7

Y

Page 56: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION

TREE REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

X < 20 1

X < 200 2

300.5 65.7 1023

-64.1 0.7

X < 1702

X < 401

yes no

yes no yes no

yes no

Page 57: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE REGRESSION TRAINING

Page 58: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE REGRESSION RESULT

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 59: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ENSEMBLE LEARNING. RANDOM FOREST REGRESSION.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

STEP 1: Pick at random K data points from the Training set.

STEP 2: Build the Decision Tree associated to these K data points.

STEP 3: Choose the number Ntree of trees you want to build and repeat STEPS 1 & 2

STEP 4: For a new data point, make each one of your Ntree trees predict the value of Y to for the data point in question, and assign the new data point the average across all of the predicted Y values.

Page 60: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RANDOM FOREST REGRESSION TRAINING

Page 61: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RANDOM FOREST REGRESSION RESULT

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 62: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

REGRESSION MODELS. PROS AND CONS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 63: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

CLASSIFICATION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Unlike regression where you predict a continuous number,

you use classification to predict a category.

There is a wide variety of classification applications from medicine to marketing.

Page 64: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

This is new:Action (Y/N)

Age

We know this:Salary ($)

Experience

y = b0 + b1*x

Page 65: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Action (Y/N) Action (Y/N)

Age Age

Page 66: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 67: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 68: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 69: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION PREDICTION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 70: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DATASET PRESENTATION. SOCIAL NETWORK ADS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 71: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION. PREPROCESSING

Page 72: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION. TRAINING

Page 73: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION. TRAINING SET RESULTS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 74: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

LOGISTIC REGRESSION. TEST SET RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 75: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 76: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

STEP 1: Choose the number K of neighbors

STEP 2: Take the K nearest neighbors of the new data point, according to the Euclidean distance

STEP 3: Among these K neighbors, count the number of data points in each category

STEP 4: Assign the new data point to the category where you counted the most neighbors

Your Model is Ready

Page 77: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 78: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Category 1: 3 neighbors

Category 2: 2 neighbors

Page 79: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS. TRAINING

Page 80: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS. TRAINING SET RESULTS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 81: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-NEAREST NEIGHBORS. TEST SET RESULTS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 82: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SUPPORT VECTOR MACHINES

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 83: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

SUPPORT VECTOR MACHINES TRAINING

Page 84: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

SUPPORT VECTOR MACHINES. TRAINING SET RESULTS.

Page 85: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

SUPPORT VECTOR MACHINES. TEST SET RESULTS.

Page 86: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 87: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 88: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 89: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 90: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 91: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 92: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 93: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

KERNEL SVM

Page 94: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

KERNEL SVM TRAINING

Page 95: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. TRAINING SET RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 96: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. TEST SET RESULTS.

RUBY

GAR

AGE

201

7

TECH

NO

LOG

Y MATTERS

Page 97: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Bayes Theorem

Page 98: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DRIVER OR WAALKER.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 99: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. BAYES THEOREM. WALKS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 100: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. BAYES THEOREM. DRIVES.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 101: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. P(WALKS).

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 102: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. P(X).

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 103: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. P(X|WALKS).

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 104: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. P(WALKS|X).

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 105: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. P(DRIVES|X).

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 106: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 107: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. NEW WALKER.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 108: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. TRAINING.

Page 109: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. TRAINING SET RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 110: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NAIVE BAYES. TEST SET RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 111: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE CLASSIFICATION

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 112: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE CLASSIFICATION. TRAINING.

Page 113: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE CLASSIFICATION. TRAINING SET RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 114: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DECISION TREE CLASSIFICATION. TEST SET RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 115: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

RANDOM FOREST CLASSIFICATION

STEP 1: Pick at random K data points from the Training set.

STEP 2: Build the Decision Tree associated to these K data points.

STEP 3: Choose the number Ntree of trees you want to build and repeat STEPS 1 & 2

STEP 4: For a new data point, make each one of your Ntree trees predict the category towhich the data point belongs, and assign the new data point to the category that winsthe majority vote.

Page 116: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RANDOM FOREST CLASSIFICATION. TRAINING

Page 117: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

RANDOM FOREST CLASSIFICATION. TRAINING SET RESULTS

Page 118: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

RANDOM FOREST CLASSIFICATION. TEST SET RESULTS.

Page 119: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

EVALUATING CLASSIFICATION MODELS PERFORMANCE.FALSE POSITIVES & FALSE NEGATIVES.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 120: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

EVALUATING CLASSIFICATION MODELS PERFORMANCE.CONFUSION MATRIX.

Page 121: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

CLASSIFICATION MODELS. PROS AND CONS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 122: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Clustering is similar to classi�cation, but the basis is di�erent. In Clustering you don’t know what you are looking for, and you are trying to identify some segments or clusters in your data. When you use clustering algorithms on your dataset, unexpected things can suddenly pop up like structures, clusters and groupings you would have never thought of otherwise.

Page 123: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 124: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

STEP 1: Choose the number K of clusters

STEP 2: Select at random K points, the centroids (not necessarily from your dataset)

STEP 3: Assign each data point to the closest centroid -> That forms K clusters

STEP 4: Compute and place the new centroid of each cluster

STEP 5: Reassign each data point to the new closest centroid. If any reassignment took place, go to STEP 4, otherwise go to FIN.

Your Model is Ready

Page 125: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

K-MEANS CLUSTERING

Page 126: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

K-MEANS CLUSTERING

Page 127: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 128: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 129: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 130: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 131: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 132: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 133: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING RANDOM INITIALIZATION PROBLEM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 134: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS CLUSTERING RANDOM INITIALIZATION PROBLEM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 135: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

K-MEANS CLUSTERING RANDOM INITIALIZATION PROBLEM

Page 136: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

K-MEANS CLUSTERING RANDOM INITIALIZATION PROBLEM

Page 137: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS SELECTING THE NUMBER OF CLUSTERS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 138: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS SELECTING THE NUMBER OF CLUSTERS

RUBY

GAR

AGE

201

7

TECH

NO

LOG

Y MATTERS

Page 139: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DATASET PRESENTATION. MALL CUSTOMERS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 140: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS. TRAINING. OPTIMAL NUMBER OF CLUSTERS.

Page 141: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS. OPTIMAL NUMBER OF CLUSTERS RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 142: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS TRAINING

Page 143: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

K-MEANS. RESULT

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 144: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING

RUBY

GAR

AGE

201

7

TECH

NO

LOG

Y MATTERS

Page 145: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

HIERARCHICAL CLUSTERING AGGLOMERATIVE

STEP 1: Make each data point a single-point cluster That forms N clusters

STEP 2: Take the two closest data points and make them one cluster That forms N-1 clusters

STEP 3: Take the two closest clusters and make them one cluster That forms N-2 clusters

STEP 4: Repeat STEP 3 until there is only one cluster

FIN

Page 146: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 147: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 148: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 149: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 150: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 151: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 152: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 153: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING AGGLOMERATIVE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 154: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING DENDROGRAMS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 155: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING DENDROGRAMS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 156: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING DENDROGRAMS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 157: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING DENDROGRAMS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 158: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING DENDROGRAMS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

4 clusters

Page 159: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DENDROGRAMS OPTIMAL NUMBER OF CLUSTERS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 160: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DENDROGRAMS OPTIMAL NUMBER OF CLUSTERS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 161: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DENDROGRAM. FINDING THE OPTIMAL NUMBER OF CLUSTERS.

Page 162: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DENDROGRAM. RESULTS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 163: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING. TRAINING.

Page 164: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HIERARCHICAL CLUSTERING RESULT

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 165: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

CLUSTERING MODELS. PROS AND CONS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 166: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

REINFORCEMENT LEARNING

Reinforcement Learning is a branch of Machine Learning, also called Online Learning. It is used to solve interacting problems where the data observed up to time t is consideredto decide which action to take at time t + 1.

It is also used for Arti�cial Intelligence when training machines to performtasks such as walking. Desired outcomes provide the AI with reward,undesired with punishment. Machines learn through trial and error.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 167: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THE MULTI-ARMED BANDIT PROBLEMHot to bet to maximize your return

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 168: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THE MULTI-ARMED BANDIT PROBLEM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 169: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THE MULTI-ARMED BANDIT PROBLEM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 170: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 171: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7

TECH

NO

LOG

Y MATTERS

Page 172: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 173: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 174: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 175: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 176: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND ALGORITHM

RUBY

GAR

AGE

201

7

TECH

NO

LOG

Y MATTERS

Page 177: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RANDOM SELECTION

Page 178: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RANDOM SELECTION. RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 179: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND. TRAINING.

Page 180: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UPPER CONFIDENCE BOUND. RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 181: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THOMPSON SAMPLING ALGORITHM

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 182: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BAYESIAN INFERENCE

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 183: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

BAYESIAN INFERENCE. EXPLANATION.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 184: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

CREATING DISTRIBUTION BASED ON AN INITIAL DATA

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 185: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

PULLING RANDOM VALUES FROM DISTRIBUTIONS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 186: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

ADJUSTING THE PERCEPTION OF THE WORLD

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 187: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THE FINAL MODEL

RUBY

GAR

AGE

201

761

TECH

NO

LOG

Y MATTERS

Page 188: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

UCB VS THOMPSON SAMPLING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 189: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THOMPSON SAMPLING ALGORITHM. TRAINING.

Page 190: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THOMPSON SAMPLING ALGORITHM. RESULTS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 191: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NATURAL LANGUAGE PROCESSING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Natural Language Processing (or NLP) is applying Machine Learningmodels to text and language.Teaching machines to understand what is said in spokenand written word is the focus of Natural.

Page 192: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NATURAL LANGUAGE PROCESSING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Natural Language Processing (or NLP) is applying Machine Learningmodels to text and language.Teaching machines to understand what is said in spokenand written word is the focus of Natural.

Page 193: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NATURAL LANGUAGE PROCESSING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Language Processing.Whenever you dictate something into your iPhone / Android devicethat is then converted to text, that’s an NLP algorithm in action.

Page 194: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NATURAL LANGUAGE PROCESSING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

You can use NLP on an article to predict somecategories of the articles you are trying to segment.You can use NLP on a book to predict the genre of the book.

Page 195: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NATURAL LANGUAGE PROCESSING

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

A very well-known model in NLP is the Bag of Words model.It is a model used to preprocess the texts to classify before�tting the classi�cation algorithms on the observationscontaining the texts.

Page 196: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

DATASET PRESENTATION. RESTAURANT REVIEWS.

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 197: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. TRAINING. IMPORTING THE DATASET AND CLEANING THE TEXTS.

Page 198: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. TRAINING. CLEANING THE TEXTS. RESULTS.

Page 199: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. TRAINING. CREATING THE BAG OF WORDS MODEL.

Page 200: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. CREATING THE BAG OF WORDS MODEL.

Page 201: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. TRAINING. SPLITTING THE DATASET INTO THE TRAINING SET AND TEST SET.

Page 202: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. TRAINING. FITTING NAIVE BAYES TO THE TRAINING SET.

Page 203: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. TRAINING. PREDICTING AND MAKING THE CONFUSION MATRIX.

Page 204: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NLP. CONFUSION MATRIX. RESULTS.

Page 205: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

THE NEURON

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 206: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

HOW DO NEURAL NETWORKS LEARN?

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 207: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

NEURAL NETWORKS

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

Page 208: Machine Learning as a Daily Work for a Programmer- Volodymyr Vorobiov

RUBY

GAR

AGE

201

7TEC

HN

OLO

GY M

ATTERS

TO BE CONTINUED