Docsity

Probabilistic Methods 2: Naive Bayes Classifier and Full Bayesian Learning, Study notes of Computer Numerical Control

Partial preview of the text

Download Probabilistic Methods 2: Naive Bayes Classifier and Full Bayesian Learning and more Study notes Computer Numerical Control in PDF only on Docsity!

CS181 Lecture 11:

Probabilistic Methods 2

David C. Parkes

Outline

  • Naïve Bayes Model
  • Maximum a posteriori learning
    • introducing a prior on μ
  • Full Bayesian learning
    • reasoning with a posterior distribution on μ
  • Bayesian model fitting

Naïve Bayes Classifier

  • Consider Boolean X 1 ,…,Xm , class Y
  • Assume that X i and X j are conditionally independent given Y
  • Only 2(m) + 1 parameters!
    • typical parameter is P(X 1 = true | Y = true)
    • also need P(Y=true)

P ( X 1 (^) ,..., X m | Y )  (^)  mj  1 P ( X j | Y )

Naïve Bayes Graphical Model

Y

X 1 X 2 … X m

Hypothesis Space

  • Linear separator!
  • Encode true as 1 and false as 0.
  • Classify x as true if

w 0 +  j w j xj ¸ 0 where weights are functions of parameters (see notes)

  • Naïve Bayes: attributes have an independent effect on the classification

An Important Point

  • Many real world domains are not linearly separable
  • Nevertheless, even for those domains there may be a pretty good linearly separable hypothesis
  • May be better than working with a richer hypothesis; need less data. Naïve Bayes often performs well in practice.

Naïve Bayes for clustering

[AutoClass]

  • Clustering with discrete feature space
  • Extend Naïve Bayes from Y={0,1} to Y={1,2,… K}
  • Run EM algorithm:
  • [E]: determine P( Y = k | X = x i) for each x i in data D , each k, using μ (old)
  • [M]: maximize expected log-likelihood, to get μ(new)

Outline

  • Naïve Bayes Model
  • Maximum a posteriori learning
    • introducing a prior on μ
  • Full Bayesian learning
    • reasoning with a posterior distribution on μ
  • Bayesian model fitting

Maximum A Posteriori

  • Want to learn parameters μ given data D
  • Max likelihood: arg maxμ P( D | μ)
    • may overfit, just uses data
  • MAP: Can incorporate a prior on μ
  • Find: arg maxμ P(μ=μ | D )

= arg maxμ P( D | μ) P(μ = μ) where P(μ = μ) is a prior

13

Example: Candy (R&N)

  • μ
  • μ
  • μ
    • μ
    • μ

Conjugate Distributions

  • For MAP, need arg maxμ P(μ=μ | D ) = arg maxμ P( D | μ)P(μ =μ )
  • A conjugate prior P(μ = μ) on parameter is one where posterior P(μ=μ | X =x) has same functional form as prior
  • See notes. E.g.,
    • for Bernoulli: Beta(μ =μ|®,¯) is conjugate prior on parameter μ; say that ® and ¯ are hyper-parameters (and assumed fixed)
    • for Gaussian: N (¹ = ¹ | ¹ 0 ,¾ 02 ) is conjugate prior on mean parameter ¹, say that {¹ 0 ,¾ 02 } are hyper- parameters (and assumed fixed)

Outline

  • Naïve Bayes Model
  • Maximum a posteriori learning
    • introducing a prior on μ
  • Full Bayesian learning
    • reasoning with a posterior distribution on μ
  • Bayesian model fitting

Full Bayesian Learning: Candy

(R&N)

examples in D

Ex.: Full Bayes for Regression

  • Data D = { (x 1 , y 1 ), …, (xn, yn) }
  • (x,y) 2 R £ R
  • Fit m-th order polynomial
  • Gaussian model
  • P( Y = y | X = x, μ) = N ( Y = y | f(x, w ), ¾^2 )
    • parameters: weights w , and var ¾^2
    • adopt a Gaussian prior on weights, set the prior to prefer small w