6.034 Artificial Intelligence - Recitations, fall 2004 online slides on learning

Next: Examples Previous: Measure Performance of a

Example

Restaurant concept

\psfig{figure=figures/fig18.5.ps}

         Suppose only considering attributes Patrons, Type, Hungry, Fri/Sat

                = Original - [None + Some + Full]
         Gain(Patrons) = 1 - [2/12 I(0,1) + 4/12 I(1,0) + 6/12 I(2/6,4/6)]
            = 0.541 bits

                = Original - [French + Italian + Thai + Burger]
         Gain(Type) = 1 - [2/12 I(1/2,1/2) + 2/12 I(1/2,1/2) +
                           4/12 I(2/4,2/4) + 4/12 I(2/4,2/4)] = 0 bits

         -------

         I(2/6,4/6) = .92
         Gain(Type) = .92 - [1/6I(0,1) + 1/6I(0,1) + 2/6I(1,1) + 2/6I(1,1)]
                    = .92 - 4/6 = .253
         Gain(Hungry) = .92 - [4/6I(1,1) + 2/6I(0,1)] = .92 - 4/6 = .253
         Gain(Fri/Sat) = .92 - [5/6I(2/5,3/5) + 1/6I(0,1)] = .92 - ? < .253
         Choose attribute Hungry

         -------

         I(2/4,2/4) = 1
         Gain(Type) = 1 - [0 + 1/4I(0,1) + 2/4I(1,1) + 1/4I(1,0)] = 1 - .5 = .5
         Gain(Fri/Sat) = 1 - [3/4I(2/3,1/3) + 1/4I(0,1)] = 1 - .75*.92 = .31
         Choose attribute Type

         -------

         I(1/2,1/2) = 1
         Gain(Fri/Sat) = 1 - [1/2I(1,0) + 1/2I(0,1)] = 1 - 0 = 1