Top Banner
An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo) 8/24/2010 - 8/26/2010
19

An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Jan 12, 2016

Download

Documents

Hector Waters
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

An Introduction toMachine Learning andNatural Language ProcessingTools

Presented by:Mark Sammons, Vivek Srikumar

(Many slides courtesy of Nick Rizzolo)

8/24/2010 - 8/26/2010

Page 2: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Some reasonably reliable facts…*

1.7 ZB (= 10^21 bytes) of new digital information added worldwide in 2010

95% of this is unstructured (e.g. not database entries)

25% is images

6EB is email (1,000 EB = 1 ZB )

How to manage/access the tiny relevant fraction of this data?

*Source: Dr. Joseph Kielman, DHS: projected figures taken from presentation in Summer 2010

Page 3: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Keyword search is NOT the answer to every problem…

Abstract/Aggregative queries: E.g. find news reports about visits by heads of

state to other countries E.g. find reviews for movies that some person

might like, given a couple of examples

Enterprise Search: Private collections of documents, e.g. all the

documents published by a corporation Much lower redundancy than web documents Need to search for concepts, not words e.g. looking for proposals with similar research

goals: wording may be very different (different scientific disciplines, different emphasis, different methodology)

Page 4: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Even when keyword search is a good start…

Waaaaay too many documents that match the key words

Solution: Filter data that is irrelevant (for task in hand)

Some examples… Different languages Spam vs. non-spam Forum/blog post topic

How to solve the Spam/non-Spam problem? Suggestions?

Page 5: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Machine Learning could help…

Instead of writing/coding rules (“expert systems”), use statistical methods to “learn” rules that perform a classification task, e.g. given a blog post, which of N different topics is it most

relevant to? Given an email, is it spam or not? Given a document, which of K different languages is it

in?

… and now, a demonstration…

The demonstration shows what a well-designed classifier can achieve. Here’s a very high-level view of how classifiers work in the context of NLP.

Page 6: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Motivating example: blog topics

Blog crawl

Page 7: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

What we need:

f( ) = “politics”

f( ) = “sports”

f( ) = “business”

Page 8: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Where to get it: Machine Learning

FeatureFunctions

Learning Algorithm

Data

→ “politics”

→ “sports”

→ “business”

Page 9: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

So, what are “feature functions”?

Take same input as Indicate some property of the input a.k.a., a

feature

Typical NLP feature functions Binary

Appearance of a given word Appearance of two words consecutively a.k.a., a bigram Appearance of a word with a given part of speech Appearance of a named entity (e.g. “Barack Obama”)

Real Counts of binary features TFIDF (a statistical measure of a document)

Page 10: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

What does the Learning Algorithm do?

Training input: a feature-based representation of examples, together with the labels we want to be able to predict E.g. 1,000 email feature sets labeled either “spam” or “non-spam” Each feature set is extracted from an email using the feature

functions Labels are typically assigned by human annotator

Computes statistics over features, relating features to labels

Generates a classifier (statistical model) that predicts a label based on the features that are active. E.g. if feature “word-’VIAGRA’-is-present” is active, predict “SPAM”

Training output: the classifier. Now it will take feature representations of new emails (no label!) and predict a label. Sometimes, it will be wrong!

Page 11: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

tAi tiit sw ,

Update Rules

Decision rule: Linear Threshold Function

Winnow – mistake driven update rules: Promotion: if , Demotion: if ,

activation

threshold

Page 12: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Cognitive Computations Software Tutorial

128/25/05

One Basic System: One vs. All Linear Threshold Function

Targets (concepts)

Features

Weighted edges, instead of weight vectors

Prediction is “one vs. all”

Page 13: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

A Training Example – 3 Newsgroups

1, 1Health, disease, review:

1, 1, 1

Computers, process, terminal, linux:

1, 1

Movies, blood, review:

diseaseprocess crime blood exceed review terminal linux gun

MoviesHealth Computers

2, 2 2, 2, 2

Health, blood, terminal:

2, 1, 2, 12, 2, 2, 2 2, 22, 1, 1, 2

Movies, blood, exceed, gun:

2, 1, 2, 1

Update rule: Winnow α = 2, β = ½, θ = 3.5

?, disease, exceed, terminal:

= 4 = 2 = 1

Page 14: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

A Training Example, abstracted…

1, 11, 1001, 1006:

1, 1, 1

2, 1002, 1007, 1008:

1, 1

3, 1006, 1004:

1001 1002 1003 1004 1005 1006 1007 1008 1009

31 2

2, 2 2, 2, 2

1, 1004, 1007:

2, 1, 2, 12, 2, 2, 2 2, 22, 1, 1, 2

3, 1004, 1005, 1009:

2, 1, 2, 1

Update rule: Winnow α = 2, β = ½, θ = 3.5

1001, 1005, 1007:

= 4 = 2 = 1

Page 15: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Adapting to New Task: Spam Filtering

What if we want to learn Spam vs. Non-Spam?

Demonstration showed that the same black box can be adapted to multiple problems… so what happens internally?

Feature functions are generic pattern extractors… for a new set of documents, new features will be

extracted

E.g. for Spam, we’d expect to see some features like “word-’VIAGRA’-is-present”

New documents come with their own set of labels (again, assigned by human annotators)

So we reuse the same code, but generate a new classifier…

Page 16: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

A Training Example – Spam Filtering

1, 1Spam, V1AGRA, medicine:

1, 1

Non-Spam, buy, medicine:

V1AGRA balding benefit buy time medicine huge panic avoid

Non-SpamSpam

2, 2

Spam, buy, huge:

2, 1, 2, 12, 2, 2, 2 2, 22, 1, 1, 2

Non-Spam, buy, time, avoid:

2, 1, 2, 1

Update rule: Winnow α = 2, β = ½, θ = 3.5

?, V1AGRA, time, huge:

= 4 = 1

Page 17: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Some Analysis…

We defined a very generic feature set – ‘bag-of-words’

We did reasonably well on three different tasks Can we do better on each task? …of course. If we add good feature functions, the

learning algorithm will find more useful patterns. Suggestions for patterns for…

Spam filtering? Newsgroup classification? …are the features we add for Spam filtering good for

Newsgroups? When we add specialized features, are we “cheating”?

In fact, a lot of time is usually spent engineering good features for individual tasks. It’s one way to add domain knowledge.

Page 18: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

A Caveat

It’s often a lot of work to learn to use a new tool set

It can be tempting to think it would be easier to just implement what you need yourself Sometimes, you’ll be right But probably not this time

Learning a tool set is an investment: payoff comes later It’s easy to add new functionality – it may already be

a method in some class in a library; if not, there’s infrastructure to support it

You will avoid certain errors: someone already made them and coded against them

Probably, it’s a lot more work than you think to DIY

Page 19: An Introduction to Machine Learning and Natural Language Processing Tools Presented by: Mark Sammons, Vivek Srikumar (Many slides courtesy of Nick Rizzolo)

Homework (!)

To prepare for tomorrow’s tutorial, you should:

Log in to the DSSI server via SSH

Check that you can transfer a file to your home directory from your laptop

If you have any questions, ask Tim or Yuancheng: Tim: [email protected] Yuancheng: [email protected]

Bring your laptop to the tutorial!!!