• Example 1.
  • Table 2 Frequency/probability table Once we build the model, we classify a new day: Sunny Hot High False
  • 20.5% P("No ") = 0.027 / (0.007 + 0.027) ≈ 79.5%
  • Oʻzbekiston respublikasi oliy va oʻrta maxsus ta’lim vazirligi urganch davlat universiteti




    Download 1.94 Mb.
    Pdf ko'rish
    bet16/99
    Sana20.02.2023
    Hajmi1.94 Mb.
    #42897
    1   ...   12   13   14   15   16   17   18   19   ...   99
    Bog'liq
    Istedod ziyosi 2022 (2)
    10 Informatika Savollar UZB, 2 sinf 2 chorak matem, 3- 4 - MAVZU (1), 88888888888, Psixologik xizmatning o`rni va ahamiyati, 13-mavzu, 602629, ADSL, 11-sinf-Fizika-darslik, [05.10.2022 20 13] ТАШКЕНТ ЮЖНЫЙ НУКУС, Health food, О КУРСЕ, 15.Mehnat muhofazasi va texnika xavfsizligi hivWBz9, Tarmoqlar komp
    Numeric Attributes. For numeric attributes we make the default 
    assumption that each of them is normally distributed for each class c
    i

    Let µ
    ij
    and 
    𝜎
    𝑖𝑗
    2
    denote the mean and variance for attribute 
    X
    j
    , for class c
    i
    . The likelihood for class c
    i
    , for dimension X
    j
    , is given as: 
    P(x
    j
    |c
    i

    ∝ f (x
    j

    ij
    ,
    σ
    ij
    2
    ) = 
    1
    √2𝜋𝜎
    𝑖𝑗
    𝑒𝑥𝑝 �−
    (𝑥
    𝑗
    −𝜇
    𝑖𝑗
    )
    2𝜎
    𝑖𝑗
    2
    � 
    Algorithm 1 shows the pseudo-code for the naive Bayes classifier. 
    Given an input dataset D, the method estimates the prior probability and 
    mean for each class. 
    Next, it computes the variance 
    σˆ
    ij
    2
    for each of the attributes X
    j
    , with 
    all the d variances for class c
    i
    stored in the vector 
    σˆ 
    i
    . The variance for 


    34 
    attribute X
    j
    is obtained by first centering the data for class D
    i
    via Z
    i
     = D
    i
     
    -1 µ
    i
    T
    The variance is then given as 
    σˆ = 
    1
    𝑛
    𝑗
     Z
    ij
     
    T
     Z
    ij

    Training the naive Bayes classifier is very fast, with O(nd) compu-
    tational complexity. For testing, given a test point x, it simply returns the 
    class with the maximum posterior probability obtained as a product of 
    the likelihood for each dimension and the class prior probability. 
    Example 1. We take the following dataset shown in Table 1 as an 
    example and build the model.
    Table 1
    Weather nominal dataset 
     


    35 
    Table 2 is a frequency/probabilities table developed by Naïve Bayes 
    model on “weather nominal” dataset. 
    Table 2 
     Frequency/probability table 
     
    Once we build the model, we classify a new day: 
    Sunny 
    Hot 
    High 
    False 

    Likelihoods: 
    P("Yes
    ") = 2/9 x 2/9 x 3/9 x 6/9 x 9/14 ≈ 0.007 
    P("No
    ") = 3/5 x 2/5 x 4/5 x 2/5 x 5/14 ≈ 0.027 
    (Normalized) probabilities: 
    P("Yes
    ") = 0.007 / (0.007 + 0.027) ≈ 20.5% 
    P("No
    ") = 0.027 / (0.007 + 0.027) ≈ 79.5%  Play = "No
    What about this day: 
    Overcast 
    Hot 
    High 
    False 
    Likelihoods: 
    P("Yes
    ") = 4/9 x 2/9 x 3/9 x 6/9 x 9/14 ≈ 0.014 
    P("No") = 0/5 x 2/5 x 4/5 x 2/5 x 5/14 = 0 
    (Normalized) probabilities: 
    P("Yes") = 0.014 / (0.014 + 0.0) = 100%  Play = "Yes
    P("No") = 0.0 / (0.014 + 0.0) = 0% 
    Does this make sense? 
    ‒one attribute “overrules” all the others…; 
    ‒we can handle this with the Laplace estimate. 
    Laplace estimate: 
    ‒Add 1 to each frequency count; 
    ‒Again, compute the probabilities. 
    Now, we build the frequency/probability table by considering 
    Laplace estimate 


    36 

    Download 1.94 Mb.
    1   ...   12   13   14   15   16   17   18   19   ...   99




    Download 1.94 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Oʻzbekiston respublikasi oliy va oʻrta maxsus ta’lim vazirligi urganch davlat universiteti

    Download 1.94 Mb.
    Pdf ko'rish