Machine Learning

   Lecture 1: Probabilistic Graphical Models
                               Phạm Duy Tùng
                    Email: duytung88@gmail.com




                                             9/9/2012
9/17/2012   Some slides copied from Pattern Recognition and Machine Learning (Bishop 2006)   1
Introduction
• Probabilistic graphical models
      • A visual presentation of probability distributions, using
        diagrams, called PGMs
• Two types of PGM
      • Bayesian Network (Directed Graphical Model)
      • Markov Network (Undirected Graphical Model)




9/17/2012                                                           2
Introduction
• Offering several useful properties:
      • They provide a simply way to visualize the
        structure of probabilistic models and motivate
        new models.
      • Insights into the properties of the models,
        including    the   conditional    independence
        properties, can be obtain by inspection of the
        graph.
      • Graph based algorithms for calculation and
        computation

9/17/2012                                            3
Topics
• Introduction
• Representation
   • Bayesian Networks (Directed Graphical Model)
   • Markov Networks (Undirected Graphical Model)
   • Converting Bayesian Networks to Markov Networks
   • Directed vs. Undirected Graphs
• Some examples
   • Naïve Bayes Classifier
   • Ising Model
• Inference
• Learning

9/17/2012                                              4
Representation
• Random variables -> Nodes
• In Conditional Independences -> Edges
  (Directed or Undirected)


            Probability                Graphical
             Models                     Models


9/17/2012                                          5
Topics
• Introduction
• Representation
   • Bayesian Networks (Directed Graphical Model)
   • Markov Networks (Undirected Graphical Model)
   • Converting Bayesian Networks to Markov Networks
   • Directed vs. Undirected Graphs
• Some examples
   • Naïve Bayes Classifier
   • Ising Model
• Inference
• Learning

9/17/2012                                              6
Representation->Bayesian Network
• Using Directed Acyclic Graph (DAG)

• Joint distribution factorizes according to graph




9/17/2012                                        7
Representation->Bayesian Network




9/17/2012                      8
Representation->Bayesian Network
• Conditional independence:

      Or equivalently:



      Denoted by:




9/17/2012                      9
Representation->Bayesian Network
• Conditional independence: Example 1




9/17/2012                               10
Representation->Bayesian Network
• Conditional independence: Example 1




9/17/2012                               11
Representation->Bayesian Network
• Conditional independence: Example 2




9/17/2012                               12
Representation->Bayesian Network
• Conditional independence: Example 2




9/17/2012                               13
Representation->Bayesian Network
• Conditional independence: Example 3




9/17/2012                               14
Representation->Bayesian Network
• Conditional independence: Example 3




9/17/2012                               15
Representation->Bayesian Network
• D-separation
      • A, B, and C are non-intersecting subsets of nodes in a directed
        graph.
      • A path from A to B is blocked if it contains a node such that
        either
          a)the arrows on the path meet either head-to-tail or tail-to-tail
            at the node, and the node is in the set C, or
          b)the arrows meet head-to-head at the node, and neither the
            node, nor any of its descendants, are in the set C.
      • If all paths from A to B are blocked, A is said to be d-separated
        from B by C.
      • If A is d-separated from B by C, the joint distribution over all
        variables in the graph satisfies           .
9/17/2012                                                                16
Representation->Bayesian Network
• D-separation: Example




9/17/2012                      17
Representation->Bayesian Network
• Markov Blanket




                   Factors independent of xi cancel
                   between numerator and denominator.



9/17/2012                                               18
Example
• Mixture of Gaussians




9/17/2012                  19
Home Work
• LDA model (David M.Blei)




9/17/2012                    20
Topics
• Introduction
• Representation
   • Bayesian Networks (Directed Graphical Model)
   • Markov Networks (Undirected Graphical Model)
   • Converting Bayesian Networks to Markov Networks
   • Directed vs. Undirected Graphs
• Some examples
   • Naïve Bayes Classifier
   • Ising Model
• Inference
• Learning

9/17/2012                                              21
Representation->Markov Network
• Many phenomenon in real life, we can not
  determine exactly the directionality to the
  interaction between random variables.
• We use Markov Network to modeling these
  phenomenon instead of Bayesian Network.




9/17/2012                                   22
Representation->Markov Network
  • Conditional independence

                               Markov Blanket




9/17/2012                                       23
Representation->Markov Network
• Factorization properties




9/17/2012                          24
Representation->Markov Network
• Clique
            Clique




                     Maximal Clique



9/17/2012                             25
Representation->Markov Network

   • where          is the potential over clique C and


   is the normalization coefficient; note: M K-state variables
   KM terms in Z.

   • Energies and the Boltzmann distribution




9/17/2012                                                        26
Representation -> Converting Bayesian
         Networks to Markov Networks




9/17/2012                                     27
Representation -> Converting Bayesian
   Networks to Markov Networks
• Additional links




9/17/2012                           28
Directed vs. Undirected Graphs




9/17/2012                              29
Directed vs. Undirected Graphs
Topics
• Introduction
• Representation
   • Bayesian Networks (Directed Graphical Model)
   • Markov Networks (Undirected Graphical Model)
   • Converting Bayesian Networks to Markov Networks
   • Directed vs. Undirected Graphs
• Some examples
   • Naïve Bayes Classifier
   • Ising Model
• Inference
• Learning



9/17/2012                                              31
Naïve Bayes Classifier


• Predicting




9/17/2012                            32
Naïve Bayes Classifier
• How to estimate      and     ?
• Solution: We can separately estimate two
  parts of the model using Maximum Likelihood




9/17/2012                                   33
Naïve Bayes Classifier




9/17/2012                            34
Naïve Bayes Classifier




9/17/2012                            35
Naïve Bayes Classifier




9/17/2012                            36
Naïve Bayes Classifier




9/17/2012                            37
Naïve Bayes Classifier




9/17/2012                            38
Naïve Bayes Classifier




9/17/2012                            39
Naïve Bayes Classifier




9/17/2012                            40
Naïve Bayes Classifier




9/17/2012                            41
Naïve Bayes Classifier




9/17/2012                            42
Naïve Bayes Classifier




9/17/2012                            43
Ising Model and Image de-noising
• Markov Random Field




9/17/2012                            44
Ising Model and Image de-noising
• An example of Ising Model used in Image
  processing.




                                Noisy Image
            Original Image




9/17/2012                                     45
Ising Model and Image de-noising




9/17/2012                            46
Ising Model and Image de-noising
• All of our assumptions about images are
  encoded as follows:




9/17/2012                                   47
Ising Model and Image de-noising




9/17/2012                            48
Ising Model and Image de-noising




9/17/2012                            49
Ising Model and Image de-noising




9/17/2012                            50
Ising Model and Image de-noising
• Results




            Noisy Image   Restored Image (ICM)




9/17/2012                                        51
Ising Model and Image de-noising
• Comparing two optimizing algorithms: Graph
  cuts vs ICM




            Restored Image (ICM)   Restored Image (Graph cuts)

9/17/2012                                                        52
Ising Model and Image de-noising
• Home works
      – Design and implement an image segmentation
        algorithms using Ising model.




9/17/2012                                            53
Topics
• Introduction
• Representation
   • Bayesian Networks (Directed Graphical Model)
   • Markov Networks (Undirected Graphical Model)
   • Converting Bayesian Networks to Markov Networks
   • Directed vs. Undirected Graphs
• Some examples
   • Naïve Bayes Classifier
   • Ising Model
• Inference
• Learning

9/17/2012                                              54
Inference




9/17/2012               55
Learning




9/17/2012              56

Lecture 1 graphical models