๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ’ซ ์ˆ˜ํ•™

Day 3: Conditional Probability, Bayes' Theorem

HackerRank Day 3:







Conditional Probability(์กฐ๊ฑด๋ถ€ ํ™•๋ฅ ):

This is defined as the probability of an event occurring, assuming that one or more other events have already occurred.

์กฐ๊ฑด๋ถ€ ํ™•๋ฅ ์€ ํ•˜๋‚˜ ์ด์ƒ์˜ ์‚ฌ๊ฑด์ด ์ด๋ฏธ ์ผ์–ด๋‚œ ํ›„์— ์–ด๋– ํ•œ ์‚ฌ๊ฑด์ด ๋ฐœ์ƒํ•  ํ™•๋ฅ ์ด๋‹ค.



Two events, A and B are considered to be independent if event A has no effect on the probability of event B.

์‚ฌ๊ฑด A๊ฐ€ ์‚ฌ๊ฑด B์— ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, ๋‘์‚ฌ๊ฑด A์™€ B๋Š” ๋…๋ฆฝ์ ์ด๋‹ค.




If events A and B are not independent, then we must consider the probability that both events occur.

This can be referred to as the intersection of events A and B,

๋งŒ์•ฝ ์‚ฌ๊ฑด A์™€ B๊ฐ€ ๋…๋ฆฝ์ ์ด์ง€ ์•Š๋‹ค๋ฉด, ์šฐ๋ฆฌ๋Š” ๋‘ ์‚ฌ๊ฑด์ด ํ•จ๊ป˜ ์ผ์–ด๋‚  ํ™•๋ฅ ์„ ๊ณ ๋ คํ•ด์•ผํ•œ๋‹ค.
์ด๋Š” A์™€ B์˜ ๊ต์ง‘ํ•ฉ์ด๋ผ ํ•  ์ˆ˜ ์žˆ๋‹ค.




We can then use this definition to find a conditional probability.

Dividing the probability of the intersection of the two events by the probability of the event that is assumed to have already occurred.

์šฐ๋ฆฌ๋Š” ์œ„์˜ ์ •์˜๋ฅผ ์ด์šฉํ•ด์„œ ์กฐ๊ฑด๋ถ€ ํ™•๋ฅ ์„ ๊ตฌํ•  ์ˆ˜ ์žˆ๋‹ค.

์ด๋ฏธ ๋ฐœ์ƒํ•œ ์‚ฌ๊ฑด์œผ๋กœ ์ถ”์ •๋˜๋Š” ์‚ฌ๊ฑด์˜ ํ™•๋ฅ ๋กœ ๋‘ ์‚ฌ๊ฑด์˜ ๊ต์ง‘ํ•ฉ์˜ ํ™•๋ฅ ์„ ๋‚˜๋ˆˆ๋‹ค.






Bayes' Theorem(๋ฒ ์ด์ง€์•ˆ ์ •๋ฆฌ):


P( A | B ) denotes the probability of the occurrence of A given that B has occurred ( B๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด, A๊ฐ€ ๋ฐœ์ƒ ํ•  ํ™•๋ฅ  )

P( B | A ) denotes the probability of the occurrence of B given that A has occurred ( A๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด, B๊ฐ€ ๋ฐœ์ƒ ํ•  ํ™•๋ฅ  )


Let A and B be two events such that P( A | B ) and P( B | A ),

A์™€ B๊ฐ€ P( A | B ) ๊ทธ๋ฆฌ๊ณ   P( B | A ) ๋ผ๋ฉด,