zoukankan      html  css  js  c++  java
  • Bayes’s formula for Conditional Probability

    Conditional Probability

    Example:
    In a batch, there are 80% C programmers, and 40% are Java and C programmers. What is the probability that a C programmer is also Java programmer?

    Let A --> Event that a student is Java programmer
        B --> Event that a student is C programmer
        P(A|B) = P(A ∩ B) / P(B)
               = (0.4) / (0.8)
               = 0.5
    So there are 50% chances that student that knows C also 
    knows Java 

    Exercise:
    1) What is the value of P(A|A)?

    2) Let P(E) denote the probability of the event E. Given P(A) = 1, P(B) = 1/2, the values of P(A | B) and P(B | A) respectively are (GATE CS 2003)
    (A) 1/4, 1/2
    (B) 1/2, 1/14
    (C) 1/2, 1
    (D) 1, 1/2

    Bayes’s formula for Conditional Probability

    Example : Box P has 2 red balls and 3 blue balls and box Q has 3 red balls and 1 blue ball. A ball is selected as follows:

    (i)  Select a box
    (ii) Choose a ball from the selected box such that each ball in
         the box is equally likely to be chosen. The probabilities of
         selecting boxes P and Q are (1/3) and (2/3), respectively.  

    Given that a ball selected in the above process is a red ball, the probability that it came from the box P is (GATE CS 2005)
    (A) 4/19
    (B) 5/19
    (C) 2/9
    (D) 19/30

    Solution:

    R --> Event that red ball is selected
    B --> Event that blue ball is selected
    P --> Event that box P is selected
    Q --> Event that box Q is selected
    
    We need to calculate P(P|R)?
    

    P(P|R) = frac{P(R|P)P(P)}{P(R)}

    P(R|P) = A red ball selected from box P
           = 2/5
    P(P) = 1/3
    P(R) = P(P)*P(R|P) + P(Q)*P(R|Q)
         = (1/3)*(2/5) + (2/3)*(3/4)
         = 2/15 + 1/2
         = 19/30
    
    Putting above values in the Bayes's Formula
    P(P|R) = (2/5)*(1/3) / (19/30)
           = 4/19



    Exercise A company buys 70% of its computers from company X and 30% from company Y. Company X produces 1 faulty computer per 5 computers and company Y produces 1 faulty computer per 20 computers. A computer is found faulty what is the probability that it was bought from company X?

  • 相关阅读:
    97. Interleaving String
    96. Unique Binary Search Trees
    95. Unique Binary Search Trees II
    94. Binary Tree Inorder Traversal
    odoo many2many字段 指定打开的form视图
    docker sentry 配置文件位置
    postgres 计算时差
    postgres 字符操作补位,字符切割
    postgres判断字符串是否为时间,数字
    odoo fields_view_get
  • 原文地址:https://www.cnblogs.com/ylHe/p/7846709.html
Copyright © 2011-2022 走看看