Search code examples
machine-learningprobabilitynaivebayes

Naive Bayes theorem to find probability


I am studying a machine learning course and there is an issue that I can not do. The point is to use this P(A|B) = P(B|A)*P(A)/P(B) rule to calculate the propability below:

udacity problem


Solution

  • First my ML for speech recognition / translation systems is a bit rusty, so I'm probably wrong. I think what is confusing you it's that it asks for the bigram probability: P(you|if) = P(if, you) / P(if), a formula you can derive from bayes:

    • P(you|if) = P(if|you) * P(you) / P(if)

      • P(if|you) * P(you) = P(if, you)
    • P(if, you) = 1/22 (21 bigrams + last bigram of OK + STOP)

    • P(if) = 1/22 (Assuming no stemming and without simbols)

    So: P(you|if) = 1/22 / 1/22 = 1

    If you consider stemming things change since "your" will become "you", and I'm also not sure about the end sign 'STOP'.