Docsity

Probabilistic Models in Machine Learning: Understanding Decision Trees and Bayes Rule, Study notes of Linguistics

Toggle sidebar
bg1
Probabilistic models
•Decision trees, instance-based learning, and transformation-based
learning are called non-parametric methods because they don’t use
an explicit probabilistic model
•Parametric machine learning methods assume a particular (typically
probabilistic) model
•Parametric methods (usually) search a much more restrictive
hypothesis space than non-parametric methods →large bias, small
variance
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Probabilistic Models in Machine Learning: Understanding Decision Trees and Bayes Rule and more Study notes Linguistics in PDF only on Docsity!

Probabilistic models

  • Decision trees, instance-based learning, and transformation-based learning are called non-parametric methods because they don’t use an explicit probabilistic model
  • Parametric machine learning methods assume a particular (typically probabilistic) model
  • Parametric methods (usually) search a much more restrictive hypothesis space than non-parametric methods → large bias, small variance

Probabilistic models

  • Suppose we have a representation of an instance as feature vector x and we want to predict its class c
  • If we have a way of modeling P(c|x), Bayes Decision Rule says our predicted cˆ should be:

c ˆ = argmax c∈C

P(c|x)

  • This minimizes the expected error:

P(error|x) = 1 − P( cˆ|x)

P(error) = ∑

x

P(error|x) P(x)

Probabilistic models

  • If Bayes decision rule minimizes error, why do we still make mistakes?
  • Overlapping classification functions (where P(c|x) 6 = 1 ) can never be learned perfectly
  • The classifier only works as well as our model – if our model P(c|x) is inaccurate, then we’ll make the wrong decisions
  • We need some way of constructing, evaluation, and selecting probability models

Baseline classifier

  • We often compute a ‘baseline’ for a classification task by simply assigning the most frequent class to each instance:

c ˆ = argmax c∈C

P(c)

  • Here we assume that P(c|x) = P(c), i.e., X and C are independent
  • The extra error a baseline classifier makes is:

x

P(x) [P(x, c) − P(x) P(c)]

Bayes Optimal Classifiers

  • The Bayes Optimal Classifier selects:

c ˆ = argmax c∈C

h∈H

P(c|x, h) P(d|h) P(h)

  • We remove the dependence on a particular h by averaging over all possible hs
  • This is almost always impossible to apply in practice, but it can used to establish a lower bound on the error rate
  • We can also sometimes approximate it, e.g., by randomly drawing h from the posterior distribution P(d|h) P(h)

Rev. Thomas Bayes (1702–1761)

Naive Bayes classifiers

  • To apply a generative Bayesian classifier, we need P(x, c)
  • We can break this down into two parts: the class prior P(c), and a likelihood P(x|c)
  • The class priors are easy to estimate from training data:

P^ ˆ(c) = # of instances in class^ c

of instances

  • This won’t work for P(x|c), since any particular feature vector x is unlikely to turn up in the training data:

P^ ˆ(x|c) = # of instances of^ x^ in^ c

of instances in c

of instances of x in c

Naive Bayes classifiers

  • To get a better estimate of P(x|c), we can make the simplifying assumption that each of the dimensions xi in x are independent, so that:

P(x|c) = ∏

i

P(xi|c)

  • Now we only need to get estimates of P(xi|c) from the data for each xi, which we can do in the usual way:

P^ ˆ(xi|c) = # of instances of^ xi^ in^ c

of instances in c

  • Both Pˆ(c) and Pˆ(xi|c) can be estimated using whatever tricks we have available

Naive Bayes classifiers

  • Ignoring word order in the feature representation removes the most obvious syntactic dependencies between words

P(the) P(book) 6 = P(the book)

  • There are still semantic dependencies:

P(tackle) P(touchdown) 6 = P(tackle, touchdown)

  • And, multiple occurrences of words are probably not independent

Text classification

  • Text classification can be useful for information retrieval and natural language processing tasks

? indexing ? message routing ? summarization

  • Text classification also plays a role in linguistic research

? authorship identification ? genre studies ? forensic linguistics ? sociolinguistics

  • A combination of the two makes the WWW available as a resource for research

Multivariate Bernoulli event model

  • If we represent a document as a set of words, then each feature xi is a Bernoulli variable, where:

P(xi|c (^) j) = P(xi = 1 |c (^) j)xi^ ( 1 − P(xi = 1 |c (^) j))^1 −xi

  • If there are v words in the vocabulary, a document is constructed by flipping v coins
  • Call pi j = P(xi = 1 |c (^) j). Substituting this in, we get:

P(c (^) j|x) =

P(c (^) j) (^) ∏i P(xi|c (^) j) P(x)

=

P(c (^) j) (^) ∏i px i ji( 1 − pi j)^1 −xi P(x)

Multivariate Bernoulli event model

  • And taking the log gives us:

log P(c j|x) = log P(c j) + ∑

i

xi log pi j + ∑

i

( 1 − xi) log( 1 − pi j) − log P(x)

= log P(c j) + ∑

i

xi log pi j + ∑

i

log( 1 − pi j) − ∑xi log( 1 − pi j) −

log P(x)

= log P(c j) + ∑

i

xi log

pi j 1 − pi j

i

log( 1 − pi j) − log P(x)

  • Suppose we only have two classes. Then P(c 1 |x) = 1 − P(c 2 |x), and the posterior log odds are:

log

P(c 1 |x) 1 − P(c 1 |x)

i

xi log

pi 1 ( 1 − pi 2 ) ( 1 − pi 1 )pi 2

i

log

1 − pi 1 1 − pi 2

  • log

P(c 1 ) 1 − P(c 1 )

Multinomial event model

  • If instead we represent a document as a bag of words, then we can model a document as a sequence of random draws from a multinomial distribution
  • The probability of picking word wi if the document class is c (^) j once is P(wi|c (^) j)
  • The probability of picking word wi xi times in a row is P(wi|c (^) j)xi
  • The probability of drawing a collection of words in that order is:

i

P(wi|ci)xi

Multinomial event model

  • This underestimates P(x|c (^) j), since lots of ordered sequences correspond to the same bag of words
  • How many different ways are there to draw word w 1 x 1 times, word w 2 x 2 , and so on?
  • We can use the multinomial coefficient :

( n n 1 , n 2 ,...

n n 1

×

n − n 1 n 2

× · · ·

n! n 1 !(n − n 1 )!

×

(n − n 1 )! n 2 !(n − n 1 − n 2 )!

× · · ·

n! n 1 !n 2! · · ·