SlideShare a Scribd company logo
Classification
Machine Learning
Supervised Learning:
 Classification: Predict a discrete value(label)
associated with feature vector.
 Regression: Predict a real number associated with a
feature vector.
E.g., Use linear regression to fit a curve to data.
Example:
Distance Matrix:
Using Distance Matrix for Classification:
 Simplest approach is probably nearest neighbors.
 Remember training data
 When predicting the label of a new example
 Find the nearest example in the training data
 Predict the label associated with that example.
Distance Matrix:
Hand-Written Character Recognition:
K-nearest neighbors
Advantages and Disadvantages of KNN:
Advantages:
 Learning Fast, no explicit training
 No theory Required
 Easy to explain method and results
Disadvantages:
 Memory intensive and predictions can take a long
time.
 No model to shed light on process that generated
data.
Naïve Baye’s Text classification:
Why?
 Learn which news articles are of interest.
 Learn to classify web pages category
Basic Intuition:
 Simple (naïve) classification method based on
Bayes rule.
 Relies on very simple representation of documents
 Bag of words
Bag of words representation:
Naïve Bayes Text Classification:
Bayes Rule:
For a document d and class c
Goal of Classifier:
Learn to Classify Text using Naïve Bayes:
Target concept interesting? : Document {+, -}
 Represent each document by vector of words
 One attribute per word position in document
 Learning : Use training examples to estimate
P(+), P(-), P(doc|+), P(doc|-)
Naïve Bayes conditional independence assumption
Where P(ai = Wk|Vj) is probability that a word
in position in i is Wk , given Vj
An example: Movie Review
Dictionary: 10 Unique words
< I, loved, the, movie, hated, a, great, good, poor,
acting>
Steps:
 Covert the documents into feature sets, where
attributes are possible words, and the values are the
number of times a word occurs in the given
document.
Doc I love
d
the movi
e
hate
d
a great goo
d
poor actin
g
Clas
s
1 1 1 1 1 +
2 1 1 1 1 -
3 2 1 1 1 +
4 1 1 -
5 1 1 1 1 1 +
Let us look at the probabilities per outcomes(+
or -)
Naïve Bayes…
 Documents with positive outcomes:
P(+)= 3/5= 0.6
Compute: P(I|+), P(loved|+), P(the|+), P(movie|+), P(a|+),
P(great|+), P(good|+), P(acting|+)
Let n be the number of words in the (+) case: 14, nk the
number of word k occurs in these case(+)
Let P(Wk|+) = (n k + 1)/(n +|vocabulary|)
Doc I loved the movie hate
d
a great goo
d
poo
r
actin
g
Clas
s
1 1 1 1 1 +
3 2 1 1 1 +
5 1 1 1 1 1 +
Naïve Bayes…
P(I|+)=0.0833 P(acting|+)=
0.0833
P(loved|+)=0.0833 P(poor|+)=
0.0417
P(the|+)= 0.0833 P(hated|+) =
0.0417
P(movie|+)= 0.2083 P(great|+)=
0.1250
P(a|+)= 0.1250 P(good|+)=
0.1250
 Now, Documents with negative class:
Doc I love
d
the movie hate
d
a gre
at
goo
d
poo
r
acting Clas
s
2 1 1 1 1 -
4 1 1 -
P(I|-)= 0.1250 P(acting|-)= 0.1250
P(loved|-)= 0.0625 P(poor|-)= 0.1250
P(the|-)= 0.1250 P(hated|-) = 0.1250
P(movie|-)= 0.1250 P(great|-)= 0.0625
P(a|-)= 0.0625 P(good|-)= 0.0625
Now, Let’s classify a new sentence w.r.t our training
samples:
Test document: I hated the poor acting
If Vj= +;
P(+)*P(I|+)*P(hated|+)*P(the|+)*P(poor|+)*P(acting|+)
6.03× 10^(-7)
If Vj= - ; P(-)*P(I|-)*P(hated|-)*P(the|-)*P(poor|-)*P(acting|-)
1.22 × 10^(-5)

More Related Content

What's hot (14)

PPTX
Lecture 09(introduction to machine learning)
Jeet Das
 
PPTX
Lecture 11
Jeet Das
 
PDF
Learning to Rank - From pairwise approach to listwise
Hasan H Topcu
 
PPT
Lec 4,5
alaa223
 
PDF
Text Classification, Sentiment Analysis, and Opinion Mining
Fabrizio Sebastiani
 
PPTX
Word vectorization(embedding) with nnlm
hyunsung lee
 
PPTX
Dual Embedding Space Model (DESM)
Bhaskar Mitra
 
PPTX
Neural Models for Information Retrieval
Bhaskar Mitra
 
PPTX
5 Lessons Learned from Designing Neural Models for Information Retrieval
Bhaskar Mitra
 
PPT
Information Retrieval 02
Jeet Das
 
PDF
Neural Semi-supervised Learning under Domain Shift
Sebastian Ruder
 
PDF
FaDA: Fast document aligner with word embedding - Pintu Lohar, Debasis Gangul...
Sebastian Ruder
 
PPTX
Lecture 6: Ensemble Methods
Marina Santini
 
PPT
MachineLearning.ppt
butest
 
Lecture 09(introduction to machine learning)
Jeet Das
 
Lecture 11
Jeet Das
 
Learning to Rank - From pairwise approach to listwise
Hasan H Topcu
 
Lec 4,5
alaa223
 
Text Classification, Sentiment Analysis, and Opinion Mining
Fabrizio Sebastiani
 
Word vectorization(embedding) with nnlm
hyunsung lee
 
Dual Embedding Space Model (DESM)
Bhaskar Mitra
 
Neural Models for Information Retrieval
Bhaskar Mitra
 
5 Lessons Learned from Designing Neural Models for Information Retrieval
Bhaskar Mitra
 
Information Retrieval 02
Jeet Das
 
Neural Semi-supervised Learning under Domain Shift
Sebastian Ruder
 
FaDA: Fast document aligner with word embedding - Pintu Lohar, Debasis Gangul...
Sebastian Ruder
 
Lecture 6: Ensemble Methods
Marina Santini
 
MachineLearning.ppt
butest
 

Similar to Lecture 10 (20)

PPTX
Naive Bayes Presentation
Md. Enamul Haque Chowdhury
 
PDF
An Overview of Naïve Bayes Classifier
ananth
 
PPTX
"Naive Bayes Classifier" @ Papers We Love Bucharest
Stefan Adam
 
PPTX
Machine Learning course Lecture number 2 - Supervised machine learning, part ...
hamedj21
 
PPT
lecture13-nbbbbb. Bbnnndnjdjdjbayes.ppt
joyaluca2
 
PPT
NaiveBayes_machine-learning(basic_ppt).ppt
artelex12
 
PPT
Text classification
Fraboni Ec
 
PPT
Text classification
Luis Goldster
 
PPT
Text classification
Tony Nguyen
 
PPT
Text classification
David Hoen
 
PPT
Text classification
Young Alista
 
PPT
Text classification
James Wong
 
PPT
Text classification
Harry Potter
 
PPTX
Search Engines
butest
 
PPTX
Sentiment analysis using naive bayes classifier
Dev Sahu
 
PPTX
Naive bayes
Ashraf Uddin
 
PDF
18 ijcse-01232
Shivlal Mewada
 
PPT
Lecture07_ Naive Bayes Classifier Machine Learning
ShafinZaman2
 
PDF
Machine learning naive bayes and svm.pdf
SubhamKumar3239
 
PDF
Bayes 6
uddingias
 
Naive Bayes Presentation
Md. Enamul Haque Chowdhury
 
An Overview of Naïve Bayes Classifier
ananth
 
"Naive Bayes Classifier" @ Papers We Love Bucharest
Stefan Adam
 
Machine Learning course Lecture number 2 - Supervised machine learning, part ...
hamedj21
 
lecture13-nbbbbb. Bbnnndnjdjdjbayes.ppt
joyaluca2
 
NaiveBayes_machine-learning(basic_ppt).ppt
artelex12
 
Text classification
Fraboni Ec
 
Text classification
Luis Goldster
 
Text classification
Tony Nguyen
 
Text classification
David Hoen
 
Text classification
Young Alista
 
Text classification
James Wong
 
Text classification
Harry Potter
 
Search Engines
butest
 
Sentiment analysis using naive bayes classifier
Dev Sahu
 
Naive bayes
Ashraf Uddin
 
18 ijcse-01232
Shivlal Mewada
 
Lecture07_ Naive Bayes Classifier Machine Learning
ShafinZaman2
 
Machine learning naive bayes and svm.pdf
SubhamKumar3239
 
Bayes 6
uddingias
 
Ad

More from Jeet Das (11)

PPTX
Lecture 13
Jeet Das
 
PPTX
Lecture 12
Jeet Das
 
PPT
Information Retrieval 08
Jeet Das
 
PPTX
Information Retrieval 07
Jeet Das
 
PPTX
Information Retrieval-06
Jeet Das
 
PPTX
Information Retrieval-05(wild card query_positional index_spell correction)
Jeet Das
 
PPTX
Information Retrieval-4(inverted index_&amp;_query handling)
Jeet Das
 
PPTX
Information Retrieval-1
Jeet Das
 
PPTX
NLP
Jeet Das
 
PPTX
Token classification using Bengali Tokenizer
Jeet Das
 
PPTX
Silent sound technology
Jeet Das
 
Lecture 13
Jeet Das
 
Lecture 12
Jeet Das
 
Information Retrieval 08
Jeet Das
 
Information Retrieval 07
Jeet Das
 
Information Retrieval-06
Jeet Das
 
Information Retrieval-05(wild card query_positional index_spell correction)
Jeet Das
 
Information Retrieval-4(inverted index_&amp;_query handling)
Jeet Das
 
Information Retrieval-1
Jeet Das
 
Token classification using Bengali Tokenizer
Jeet Das
 
Silent sound technology
Jeet Das
 
Ad

Recently uploaded (20)

PDF
th International conference on Big Data, Machine learning and Applications (B...
Zac Darcy
 
PDF
A NEW FAMILY OF OPTICALLY CONTROLLED LOGIC GATES USING NAPHTHOPYRAN MOLECULE
ijoejnl
 
PDF
An Evaluative Study on Performance Growth Plan of ICICI Mutual Fund and SBI M...
PoonamKilaniya
 
PDF
Natural Language processing and web deigning notes
AnithaSakthivel3
 
PDF
MRI Tool Kit E2I0500BC Plus Presentation
Ing. Ph. J. Daum GmbH & Co. KG
 
PPTX
Mining Presentation Underground - Copy.pptx
patallenmoore
 
PDF
IEEE EMBC 2025 「Improving electrolaryngeal speech enhancement via a represent...
NU_I_TODALAB
 
PPT
Hazard identification and risk assessment PPT
SUNILARORA51
 
PDF
Comparative Analysis of the Use of Iron Ore Concentrate with Different Binder...
msejjournal
 
PDF
1_ISO Certifications by Indian Industrial Standards Organisation.pdf
muhammad2010960
 
PDF
SMART HOME AUTOMATION PPT BY - SHRESTH SUDHIR KOKNE
SHRESTHKOKNE
 
PDF
Air -Powered Car PPT by ER. SHRESTH SUDHIR KOKNE.pdf
SHRESTHKOKNE
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PDF
13th International Conference of Networks and Communications (NC 2025)
JohannesPaulides
 
PPTX
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
PPTX
Sensor IC System Design Using COMSOL Multiphysics 2025-July.pptx
James D.B. Wang, PhD
 
PPTX
Smart_Cities_IoT_Integration_Presentation.pptx
YashBhisade1
 
PDF
BEE331-Week 04-SU25.pdf semiconductors UW
faemoxley
 
PPTX
File Strucutres and Access in Data Structures
mwaslam2303
 
PPTX
ENSA_Module_8.pptx_nice_ipsec_presentation
RanaMukherjee24
 
th International conference on Big Data, Machine learning and Applications (B...
Zac Darcy
 
A NEW FAMILY OF OPTICALLY CONTROLLED LOGIC GATES USING NAPHTHOPYRAN MOLECULE
ijoejnl
 
An Evaluative Study on Performance Growth Plan of ICICI Mutual Fund and SBI M...
PoonamKilaniya
 
Natural Language processing and web deigning notes
AnithaSakthivel3
 
MRI Tool Kit E2I0500BC Plus Presentation
Ing. Ph. J. Daum GmbH & Co. KG
 
Mining Presentation Underground - Copy.pptx
patallenmoore
 
IEEE EMBC 2025 「Improving electrolaryngeal speech enhancement via a represent...
NU_I_TODALAB
 
Hazard identification and risk assessment PPT
SUNILARORA51
 
Comparative Analysis of the Use of Iron Ore Concentrate with Different Binder...
msejjournal
 
1_ISO Certifications by Indian Industrial Standards Organisation.pdf
muhammad2010960
 
SMART HOME AUTOMATION PPT BY - SHRESTH SUDHIR KOKNE
SHRESTHKOKNE
 
Air -Powered Car PPT by ER. SHRESTH SUDHIR KOKNE.pdf
SHRESTHKOKNE
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
13th International Conference of Networks and Communications (NC 2025)
JohannesPaulides
 
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
Sensor IC System Design Using COMSOL Multiphysics 2025-July.pptx
James D.B. Wang, PhD
 
Smart_Cities_IoT_Integration_Presentation.pptx
YashBhisade1
 
BEE331-Week 04-SU25.pdf semiconductors UW
faemoxley
 
File Strucutres and Access in Data Structures
mwaslam2303
 
ENSA_Module_8.pptx_nice_ipsec_presentation
RanaMukherjee24
 

Lecture 10

  • 2. Supervised Learning:  Classification: Predict a discrete value(label) associated with feature vector.  Regression: Predict a real number associated with a feature vector. E.g., Use linear regression to fit a curve to data.
  • 5. Using Distance Matrix for Classification:  Simplest approach is probably nearest neighbors.  Remember training data  When predicting the label of a new example  Find the nearest example in the training data  Predict the label associated with that example.
  • 9. Advantages and Disadvantages of KNN: Advantages:  Learning Fast, no explicit training  No theory Required  Easy to explain method and results Disadvantages:  Memory intensive and predictions can take a long time.  No model to shed light on process that generated data.
  • 10. Naïve Baye’s Text classification: Why?  Learn which news articles are of interest.  Learn to classify web pages category Basic Intuition:  Simple (naïve) classification method based on Bayes rule.  Relies on very simple representation of documents  Bag of words
  • 11. Bag of words representation:
  • 12. Naïve Bayes Text Classification: Bayes Rule: For a document d and class c Goal of Classifier:
  • 13. Learn to Classify Text using Naïve Bayes: Target concept interesting? : Document {+, -}  Represent each document by vector of words  One attribute per word position in document  Learning : Use training examples to estimate P(+), P(-), P(doc|+), P(doc|-) Naïve Bayes conditional independence assumption Where P(ai = Wk|Vj) is probability that a word in position in i is Wk , given Vj
  • 14. An example: Movie Review Dictionary: 10 Unique words < I, loved, the, movie, hated, a, great, good, poor, acting>
  • 15. Steps:  Covert the documents into feature sets, where attributes are possible words, and the values are the number of times a word occurs in the given document. Doc I love d the movi e hate d a great goo d poor actin g Clas s 1 1 1 1 1 + 2 1 1 1 1 - 3 2 1 1 1 + 4 1 1 - 5 1 1 1 1 1 + Let us look at the probabilities per outcomes(+ or -)
  • 16. Naïve Bayes…  Documents with positive outcomes: P(+)= 3/5= 0.6 Compute: P(I|+), P(loved|+), P(the|+), P(movie|+), P(a|+), P(great|+), P(good|+), P(acting|+) Let n be the number of words in the (+) case: 14, nk the number of word k occurs in these case(+) Let P(Wk|+) = (n k + 1)/(n +|vocabulary|) Doc I loved the movie hate d a great goo d poo r actin g Clas s 1 1 1 1 1 + 3 2 1 1 1 + 5 1 1 1 1 1 +
  • 17. Naïve Bayes… P(I|+)=0.0833 P(acting|+)= 0.0833 P(loved|+)=0.0833 P(poor|+)= 0.0417 P(the|+)= 0.0833 P(hated|+) = 0.0417 P(movie|+)= 0.2083 P(great|+)= 0.1250 P(a|+)= 0.1250 P(good|+)= 0.1250  Now, Documents with negative class: Doc I love d the movie hate d a gre at goo d poo r acting Clas s 2 1 1 1 1 - 4 1 1 -
  • 18. P(I|-)= 0.1250 P(acting|-)= 0.1250 P(loved|-)= 0.0625 P(poor|-)= 0.1250 P(the|-)= 0.1250 P(hated|-) = 0.1250 P(movie|-)= 0.1250 P(great|-)= 0.0625 P(a|-)= 0.0625 P(good|-)= 0.0625 Now, Let’s classify a new sentence w.r.t our training samples: Test document: I hated the poor acting If Vj= +; P(+)*P(I|+)*P(hated|+)*P(the|+)*P(poor|+)*P(acting|+) 6.03× 10^(-7) If Vj= - ; P(-)*P(I|-)*P(hated|-)*P(the|-)*P(poor|-)*P(acting|-) 1.22 × 10^(-5)