ML 12 NLP Example
ML 12 NLP Example
https://towardsdatascience.com/natural-language-processing-nlp-for-
machine-learning-d44498845d5b
See http://pypi.python.org/pypi/nltk
n = 1,114
The City College of New York
From Shetty
CSc 59929 – Introduction to Machine Learning 24
Spring 2020 – Erik K. Grimmelmann, Ph.D.
Spam-Ham classifier results
TN FP
FN TP
n = 1,114
The City College of New York
From Shetty
CSc 59929 – Introduction to Machine Learning 25
Spring 2020 – Erik K. Grimmelmann, Ph.D.
Spam-Ham classifier results
Precision = TP/(TP+FP)
Recall = TP/(TP+FN)
F1 = 2*Pr*Re/(Pr+Re)
Accuracy = (TP+TN)/n
TN FP
FN TP From Shetty
The City College of New York
CSc 59929 – Introduction to Machine Learning 26
Spring 2020 – Erik K. Grimmelmann, Ph.D.
Confusion matricies
True
P N
Predicted P TP FP
N FN TN
True
P N
Predicted P TP FP
N FN TN
True
P N
Predicted P TP FP
N FN TN
N TN FP P TP FN
True
True
P FN TP N FP TN
True True
N P P N
Predicted
N TN FN P TP FP
Predicted
P FP TP N FN TN