TEXT CLASSIFICATION CC437 (Includes some original material by Chris Manning)

Slides:



Advertisements
Similar presentations
Naïve Bayes. Bayesian Reasoning Bayesian reasoning provides a probabilistic approach to inference. It is based on the assumption that the quantities of.
Advertisements

Naïve-Bayes Classifiers Business Intelligence for Managers.
Text Categorization CSC 575 Intelligent Information Retrieval.
Middle Term Exam 03/01 (Thursday), take home, turn in at noon time of 03/02 (Friday)
Data Mining Classification: Naïve Bayes Classifier
Bayes Rule How is this rule derived? Using Bayes rule for probabilistic inference: –P(Cause | Evidence): diagnostic probability –P(Evidence | Cause): causal.
1 Chapter 12 Probabilistic Reasoning and Bayesian Belief Networks.
Lecture 13-1: Text Classification & Naive Bayes
Introduction to Bayesian Learning Bob Durrant School of Computer Science University of Birmingham (Slides: Dr Ata Kabán)
Generative Models Rong Jin. Statistical Inference Training ExamplesLearning a Statistical Model  Prediction p(x;  ) Female: Gaussian distribution N(
1er. Escuela Red ProTIC - Tandil, de Abril, Bayesian Learning 5.1 Introduction –Bayesian learning algorithms calculate explicit probabilities.
Introduction to Bayesian Learning Ata Kaban School of Computer Science University of Birmingham.
CS276A Text Retrieval and Mining Lecture 11. Recap of the last lecture Probabilistic models in Information Retrieval Probability Ranking Principle Binary.
Text Categorization Moshe Koppel Lecture 2: Naïve Bayes Slides based on Manning, Raghavan and Schutze.
Review Rong Jin. Comparison of Different Classification Models  The goal of all classifiers Predicating class label y for an input x Estimate p(y|x)
CS Bayesian Learning1 Bayesian Learning. CS Bayesian Learning2 States, causes, hypotheses. Observations, effect, data. We need to reconcile.
Information extraction from bioinformatics related documents
Naïve Bayes for Text Classification: Spam Detection
Advanced Multimedia Text Classification Tamara Berg.
NAÏVE BAYES CLASSIFIER 1 ACM Student Chapter, Heritage Institute of Technology 10 th February, 2012 SIGKDD Presentation by Anirban Ghose Parami Roy Sourav.

Information Retrieval and Web Search Introduction to Text Classification (Note: slides in this set have been adapted from the course taught by Chris Manning.
Processing of large document collections Part 2 (Text categorization) Helena Ahonen-Myka Spring 2006.

Bayesian Networks. Male brain wiring Female brain wiring.
CSCI 5417 Information Retrieval Systems Jim Martin Lecture 11 9/29/2011.
1 Logistic Regression Adapted from: Tom Mitchell’s Machine Learning Book Evan Wei Xiang and Qiang Yang.
DATA MINING LECTURE 10 Classification k-nearest neighbor classifier Naïve Bayes Logistic Regression Support Vector Machines.
Text Classification, Active/Interactive learning.
How to classify reading passages into predefined categories ASH.
1 Data Mining Lecture 5: KNN and Bayes Classifiers.
Naive Bayes Classifier
Statistical NLP: Lecture 8 Statistical Inference: n-gram Models over Sparse Data (Ch 6)
©2012 Paula Matuszek CSC 9010: Text Mining Applications: Document-Based Techniques Dr. Paula Matuszek
Mining di dati web Classificazioni di Documenti Web Fondamenti di Classificazione e Naive Bayes A.A 2006/2007.
Statistical NLP Winter 2009 Lecture 4: Text categorization through Naïve Bayes Roger Levy ありがとう to Chris Manning for slides.
1 CS 391L: Machine Learning: Bayesian Learning: Naïve Bayes Raymond J. Mooney University of Texas at Austin.
Information Retrieval and Organisation Chapter 13 Text Classification and Naïve Bayes Dell Zhang Birkbeck, University of London.
Empirical Research Methods in Computer Science Lecture 7 November 30, 2005 Noah Smith.
WEB BAR 2004 Advanced Retrieval and Web Mining Lecture 15.
1 Bayesian Methods. 2 Naïve Bayes New data point to classify: X=(x 1,x 2,…x m ) Strategy: – Calculate P(C i /X) for each class C i. – Select C i for which.
Bayesian Classification. Bayesian Classification: Why? A statistical classifier: performs probabilistic prediction, i.e., predicts class membership probabilities.
Classification Techniques: Bayesian Classification
Artificial Intelligence 8. Supervised and unsupervised learning Japan Advanced Institute of Science and Technology (JAIST) Yoshimasa Tsuruoka.
CHAPTER 6 Naive Bayes Models for Classification. QUESTION????
Information Retrieval Lecture 4 Introduction to Information Retrieval (Manning et al. 2007) Chapter 13 For the MSc Computer Science Programme Dell Zhang.
KNN & Naïve Bayes Hongning Wang Today’s lecture Instance-based classifiers – k nearest neighbors – Non-parametric learning algorithm Model-based.
Statistical NLP Winter 2008 Lecture 4: Text classification through Naïve Bayes Roger Levy ありがとう to Chris Manning for slides.
Machine Learning Concept Learning General-to Specific Ordering
Text Categorization With Support Vector Machines: Learning With Many Relevant Features By Thornsten Joachims Presented By Meghneel Gore.
Web Search and Text Mining Lecture 17: Naïve BayesText Classification.
DATA MINING LECTURE 10b Classification k-nearest neighbor classifier
1 Machine Learning: Lecture 6 Bayesian Learning (Based on Chapter 6 of Mitchell T.., Machine Learning, 1997)
Chapter 6. Classification and Prediction Classification by decision tree induction Bayesian classification Rule-based classification Classification by.
Naïve Bayes Classifier April 25 th, Classification Methods (1) Manual classification Used by Yahoo!, Looksmart, about.com, ODP Very accurate when.
BAYESIAN LEARNING. 2 Bayesian Classifiers Bayesian classifiers are statistical classifiers, and are based on Bayes theorem They can calculate the probability.
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 15: Text Classification & Naive Bayes 1.
KNN & Naïve Bayes Hongning Wang
Naive Bayes Classifier. REVIEW: Bayesian Methods Our focus this lecture: – Learning and classification methods based on probability theory. Bayes theorem.
CMPS 142/242 Review Section Fall 2011 Adapted from Lecture Slides.
CS276B Text Information Retrieval, Mining, and Exploitation Lecture 4 Text Categorization I Introduction and Naive Bayes Jan 21, 2003.
Naive Bayes Classifier
Lecture 15: Text Classification & Naive Bayes
Data Mining Lecture 11.
Classification Techniques: Bayesian Classification
Where did we stop? The Bayes decision rule guarantees an optimal classification… … But it requires the knowledge of P(ci|x) (or p(x|ci) and P(ci)) We.
Information Retrieval
Machine Learning: UNIT-3 CHAPTER-1
Naive Bayes Classifier
Naïve Bayes Classifier
Presentation transcript:

TEXT CLASSIFICATION CC437 (Includes some original material by Chris Manning)

CATEGORIZATION / CLASSIFICATION Given: – A description of an instance, x  X, where X is the instance language or instance space. E.g: how to represent text documents. – A fixed set of categories C = {c 1, c 2,…, c n } Determine: – The category of x: c(x)  C, where c(x) is a categorization function whose domain is X and whose range is C.

A GRAPHICAL VIEW OF TEXT CLASSIFICATION NLP Graphics AI Theory Arch.

TEXT CLASSIFICATION This concerns you as a patient. Our medical records indicate you have had a history of illness. We are now encouraging all our patients to use this highly effective and safe solution. Proven worldwide, feel free to read the many reports on our site from the BBC & ABC News. We highly recommend you try this Anti-Microbial Peptide as soon as possible since its world supply is limited. The results will show quickly. Regards, 85% of all !!

EXAMPLES OF TEXT CATEGORIZATION LABELS=BINARY – “spam” / “not spam” LABELS=TOPICS – “finance” / “sports” / “asia” LABELS=OPINION – “like” / “hate” / “neutral” LABELS=AUTHOR – “Shakespeare” / “Marlowe” / “Ben Jonson” – The Federalist papers

Methods (1) Manual classification – Used by Yahoo!, Looksmart, about.com, ODP, Medline – very accurate when job is done by experts – consistent when the problem size and team is small – difficult and expensive to scale Automatic document classification – Hand-coded rule-based systems Reuters, CIA, Verity, … Commercial systems have complex query languages (everything in IR query languages + accumulators)

Methods (2) Supervised learning of document-label assignment function: Autonomy, Kana, MSN, Verity, … Naive Bayes (simple, common method) k-Nearest Neighbors (simple, powerful) Support-vector machines (new, more powerful) … plus many other methods No free lunch: requires hand-classified training data But can be built (and refined) by amateurs

Bayesian Methods Learning and classification methods based on probability theory (see spelling / POS) Bayes theorem plays a critical role Build a generative model that approximates how data is produced Uses prior probability of each category given no information about an item. Categorization produces a posterior probability distribution over the possible categories given a description of an item.

Bayes’ Rule

Maximum a posteriori Hypothesis

Maximum likelihood Hypothesis If all hypotheses are a priori equally likely, we only need to consider the P(D|h) term:

Naive Bayes Classifiers Task: Classify a new instance based on a tuple of attribute values

Naïve Bayes Classifier: Assumptions P(c j ) – Can be estimated from the frequency of classes in the training examples. P(x 1,x 2,…,x n |c j ) – Need very, very large number of training examples  Conditional Independence Assumption: Assume that the probability of observing the conjunction of attributes is equal to the product of the individual probabilities.

Flu X1X1 X2X2 X5X5 X3X3 X4X4 feversinuscoughrunnynosemuscle-ache The Naïve Bayes Classifier Conditional Independence Assumption: features are independent of each other given the class:

Learning the Model Common practice:maximum likelihood – simply use the frequencies in the data C X1X1 X2X2 X5X5 X3X3 X4X4 X6X6

Using Naive Bayes Classifiers to Classify Text: Basic method Attributes are text positions, values are words. Still too many possibilities Assume that classification is independent of the positions of the words – Use same parameters for each position

Text j  single document containing all docs j for each word x k in Vocabulary – n k  number of occurrences of x k in Text j – Text Classification Algorithms: Learning From training corpus, extract Vocabulary Calculate required P(c j ) and P(x k | c j ) terms – For each c j in C do docs j  subset of documents for which the target class is c j

Text Classification Algorithms: Classifying positions  all word positions in current document which contain tokens found in Vocabulary Return c NB, where

Naïve Bayes Posterior Probabilities Classification results of naïve Bayes (the class with maximum posterior probability) are usually fairly accurate. However, due to the inadequacy of the conditional independence assumption, the actual posterior-probability numerical estimates are not. – Output probabilities are generally very close to 0 or 1.

Feature selection via Mutual Information We might not want to use all words, but just reliable, good discriminators In training set, choose k words which best discriminate the categories. One way is in terms of Mutual Information: – For each word w and each category c

OTHER APPROACHES TO FEATURE SELECTION T-TEST CHI SQUARE TF/IDF (CFR. IR lectures) Yang & Pedersen 1997: eliminating features leads to improved performance

NAÏVE BAYES NOT SO NAIVE Naïve Bayes: First and Second place in KDD-CUP 97 competition, among 16 (then) state of the art algorithms Robust to Irrelevant Features Irrelevant Features cancel each other without affecting results Instead Decision Trees & Nearest-Neighbor methods can heavily suffer from this. Very good in Domains with many equally important features Decision Trees suffer from fragmentation in such cases – especially if little data A good dependable baseline for text classification (but not the best)! Optimal if the Independence Assumptions hold: – If assumed independence is correct, then it is the Bayes Optimal Classifier for problem Very Fast: – Learning with one pass over the data; testing linear in the number of attributes, and document collection size Low Storage requirements Handles Missing Values

PANTEL AND LIN: SPAMCOP Uses a Naïve Bayes classifier M is spam if P(Spam|M) > P(NonSpam|M) Method – Tokenize message using Porter Stemmer – Estimate P(W|C) using m-estimate (a form of smoothing) – Remove words that do not satisfy certain conditions – Train: 160 spams, 466 non-spams – Test: 277 spams, 346 non-spams Results: ERROR RATE of 4.33% – Worse results using trigrams

OTHER CLASSIFICATION METHODS K-NN DECISION TREES LOGISTIC REGRESSION SUPPORT VECTOR MACHINES

REFERENCES Mosteller, F., & Wallace, D. L. (1984). Applied Bayesian and Classical Inference: the Case of the Federalist Papers (2nd ed.). New York: Springer- Verlag. P. Pantel and D. Lin, “SPAMCOP: A Spam classification and organization program”, In Proc. Of the 1998 workshop on learning for text categorization, AAAI Sebastiani, F., 2002, “Machine Learning in Automated Text Categorization”, ACM Computing Surveys, 34(1), 1-47