440 likes | 464 Views
Automatic Text Classification through Machine Learning. David W. Miller Semantic Web Spring 2002 Department of Computer Science University of Georgia www.cs.uga.edu/~miller/SemWeb. Query to General-Purpose Search Engine: +camp +basketball “north carolina” “two weeks”.
E N D
Automatic Text Classification through Machine Learning David W. Miller Semantic Web Spring 2002 Department of Computer Science University of Georgia www.cs.uga.edu/~miller/SemWeb
Query to General-Purpose Search Engine: +camp +basketball “north carolina” “two weeks” Automatic Text Classification through Machine Learning, McCallum, et. al.
Domain-Specific Search Engine Automatic Text Classification through Machine Learning, McCallum, et. al.
Automatic Text Classification through Machine Learning, McCallum, et. al.
Automatic Text Classification through Machine Learning, McCallum, et. al.
Domain-Specific Search EngineAdvantages • High precision. • Powerful searches on domain-specific features. • by location, time, price, institution. • Domain-specific presentation interfaces: • Topic hierarchies. • Specific fields shown in clear format. • Links for special relationships. Automatic Text Classification through Machine Learning, McCallum, et. al.
Domain-Specific Search EngineDisadvantages • Much human effort to build and maintain! • e.g. Yahoo has hired many people to build their hierarchy, and maintain “Full Coverage”, etc. Automatic Text Classification through Machine Learning, McCallum, et. al.
Tough Tasks • Find pages that belong in the search engine. • Find specific fields (price, location, etc). • Organize the content for browsing. Automatic Text Classification through Machine Learning, McCallum, et. al.
Machine Learning to the Rescue! • Find pages that belong in the search engine. • Efficient spidering by reinforcement learning. • Find specific fields (price, location, etc). • Information extraction with hidden Markov models. • Organize the content for browsing. • Populate a topic hierarchy by documentclassification. Automatic Text Classification through Machine Learning, McCallum, et. al.
Building Text Classifiers • Manual approach • Interactive query refinement • Expert system methodologies • Supervised learning • 1. “Expert” labels example texts with classes • 2. Machine learning algorithm produces rule that tends to agree with expert classifications Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Advantages of Using Machine Learning to Build Classifiers • Requires no linguistic or computer skills • Competitive with manual rule-writing • Forces good practices • Looking at data • Estimating accuracy • Can be combined with manual engineering • ML research pays too little attention to this Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Selected features Feature vectors Selected features Feature selection Prepare training samples Text representation Profiles/Rules Model induction Main Processes for aMachine-Learning System Supervised Machine-Learning Based Text Categorization, Ng Hong I
Preparation of Training Texts • Essential for a supervised machine learning text categorization system • Decide on the set of categories • A set of positive training texts is prepared for each of the categories • Assign subject code(s) to each of the training texts • More than one subject code may be assigned to one training text Supervised Machine-Learning Based Text Categorization, Ng Hong I
Demonstration System: Cora • Find pages that belong in the search engine. • Spider CS departments for research papers. • Find specific fields (price, location, etc). • Extract titles, authors, abstracts, institutions, etc from paper headers and references. • Organize the content for browsing. • Populate a hand-built topic hierarchy by using text classification. Automatic Text Classification through Machine Learning, McCallum, et. al.
Automatic Text Classification through Machine Learning, McCallum, et. al.
Automatic Text Classification through Machine Learning, McCallum, et. al.
See also CiteSeer [Bollacker, Lawrence & Giles ‘98] Automatic Text Classification through Machine Learning, McCallum, et. al.
Automatic Text Classification through Machine Learning, McCallum, et. al.
Automatic Text Classification via Statistical Methods • Text Categorization is the problem of assigning predefined categories to free text documents. • Popular Approach is Statistical Learning Methods • Bayes Method • Rocchio Method (most popular) • Decision Trees • K-Nearest Neighbor Classification • Support Vector Machines (fairly new concept)
“Bag-of-words” 35 a 1 block 12 computer 4 field 1 leg 7 machine 44 of 3 paper 2 perspective 1 rate 5 reinforcement 9 science 2 survey 56 the 11 this 1 underrated … … Reinforcement Learning: a Survey This paper surveys the field of rein- forcement learning from a computer science perspective. A Probabilistic Generative Model • Define a probabilistic generative model for documents with classes.Bayes: Automatic Text Classification through Machine Learning, McCallum, et. al.
Bayes Method Pick the most probable class, given the evidence: - a class (like “Planning”) - a document (like “language intelligence proof...”) Bayes Rule: Probability Category cj should be assigned to document d Automatic Text Classification through Machine Learning, McCallum, et. al.
Bayes Rule - Probability that document d belongs to category cj - Probability that a randomly picked document has the same attributes - Probability that a randomly picked document belongs to this category - Probability that category c contains document d
Bayes Method • Generates conditional probabilities of particular words occurring in a document given it belongs to a particular category. • Larger vocabulary generate better probabilities • Each category is given a threshold p for which it judges the worthiness of a document to fall in that classification. • Documents may fall into one, more than one, or not even one category.
Rocchio Method • Each document is D is represented as a vector within a given vector space V: • Documents with similar content have similar vectors • Each dimension of the vector space represents a word selected via a feature selection process
Rocchio Method • Values of d(i) for a document d are calculated as a combination of the statistics TF(w,d) and DF(w) • TF(w,d) (Term Frequency) is the number of times word w occurs in a document d. • DF(w) (Document Frequency) is the number of documents in which the word w occurs at least once.
Rocchio Method • The inverse document frequency is calculated as • Value of d(i) of feature wifor a document d is calculated as the product • d(i) is called the weight of the word wiin the document d.
Rocchio Method • Based on word weight heuristics, the word wi is an important indexing term for a document d if it occurs frequently in that document • However, words that occurs frequently in many document spanning many categories are rated less importantly
Decision Tree Learning Algorithm • Probabilistic methods have been criticized since they are not easily interpreted by humans, not so with Decision Trees • Decision Trees fall into the category of symbolic (non-numeric) algorithms
Decision Trees • Internal nodes are labeled by terms • Branches (departing from a node) are labeled by tests on the weight that the term has in a test document • Leafs are labeled by categories
Decision Tree • Classifier categorizes a test document d by recursively testing for the weights that the terms labeling the internal nodes have until a leaf node is reached. • The label of the leaf node is then assigned to the document • Most decision trees are binary trees
Decision Tree • Fully grown trees tend to have decision rules that are overly specific and are therefore unable to categorize documents • Therefore, pruning and growing methods for such Decision Trees are normally standard part of the classification packages
K-Nearest Neighbor • Features • All instances correspond to points in an n-dimensional Euclidean space • Classification is delayed till a new instance arrives • Classification done by comparing feature vectors of the different points • Target function may be discrete or real-valued K-Nearest Neighbor Learning, Dipanjan Chakraborty
1-Nearest Neighbor K-Nearest Neighbor Learning, Dipanjan Chakraborty
K-Nearest Neighbor • An arbitrary instance is represented by (a1(x), a2(x), a3(x),.., an(x)) • ai(x) denotes features • Euclidean distance between two instances d(xi, xj)=sqrt (sum for r=1 to n (ar(xi) - ar(xj))2) • Find the k-nearest neighbors whose distance from your test cases falls within a threshold p. • If x of those k-nearest neighbors are in category ci, then assign the test case to ci, else it is unmatched. K-Nearest Neighbor Learning, Dipanjan Chakraborty
Support Vector Machines • Based on the Structural Risk Minimization principle form computational learning theory • Find a hypothesis h for which we can guarantee the lowest true error • The true error of h is the probability that h will make an error on an unseen and randomly selected test example
Evaluating Learning Algorithms and Software • How effective/accurate is classification? • Compatibility with operational environment • Resource usage • Persistence • Areas learning algorithms need improvement Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Effectiveness: Contingency Table Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Effectiveness Measures • recall = a/(a+c) • precision = a/(a+b) • accuracy = (a+c)/(a+b+c+d) • utility = any weighted average of a,b,c,d • F-measure = 2a/(2a+b+c) • others Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Effectiveness: How to Predict • Theoretical gaurantees rarely useful • Test system on manually classified data • Representativeness of sample important • Will data vary over time? • Effectiveness varies widely across classes and data sets • Interindexer agreement an upper bound? Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Effectiveness: How to Improve • More training data • Better training data • Better text representation • Usual IR tricks (term weighting, etc.) • Manually construct good predictor features • e.g. % capitalized letters for spam filtering • Hand off hard cases to human being Machine Learning for Text Classification, David D. Lewis, AT&T Labs
Conclusions • Performance of classifier depends strongly on the choice of data used for evaluation. • Dense category space become problematic for unique categorization, many documents share characteristics
Credits*This Presentation is Partially Based on Those of Others Listed Below* • Supervised Machine Learning Based Text Categorization • Machine Learning for Text Classification • Automatically Building Internet Portals using Machine Learning • Web Search • Machine Learning • K-Nearest Neighbor Learning Full Presentations can be found at: http://webster.cs.uga.edu/~miller/SemWeb/Presentation/ACT.html
Resources • Text Categorization Using Weight Adjusted k-Nearest Neighbor Classification • A Probalisitic Analysis of the Rocchio Alg. w/ TFIDF for Text Categorization • Text Categorization w/ Support Vector Machines • Learning to Extract Symbolic Knowledge from the WWW • An Evaluation of Statistical Approaches to Text Categorization • A Comparison of Two Learning Algorithms for Text Categorization • Machine Learning in Automated Text Categorization Full List of Resources can be found at: http://webster.cs.uga.edu/~miller/SemWeb/Presentation/ACT.html