Editing
Probability Theory
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Modeling 'Bayesian Inference' (Spam Filtering):''' <syntaxhighlight lang="python"> def update_probability(prior_prob, prob_evidence_given_spam, prob_evidence_given_ham): """ Bayes' Theorem: P(Spam|Word) = [P(Word|Spam) * P(Spam)] / P(Word) """ # P(Word) = P(Word|Spam)P(Spam) + P(Word|Ham)P(Ham) p_ham = 1 - prior_prob p_word = (prob_evidence_given_spam * prior_prob) + (prob_evidence_given_ham * p_ham) posterior_prob = (prob_evidence_given_spam * prior_prob) / p_word return posterior_prob # Prior: 10% of emails are spam. # 'Buy Now' appears in 80% of spam but only 1% of ham. print(f"Prob it is spam if it says 'Buy Now': {update_probability(0.1, 0.8, 0.01):.2f}") # This 'Learning' logic is how your email filter gets smarter. </syntaxhighlight> ; Probability Paradoxes : '''The Monty Hall Problem''' β Why you should always "switch doors" on a game show (it doubles your chances!). : '''The Birthday Paradox''' β In a room of just 23 people, there is a 50% chance two share a birthday. : '''Simpson's Paradox''' β A trend appears in several different groups of data but disappears or reverses when these groups are combined. </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information