CT932

Bayes: Spam Classification

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the Postal Intelligence Office of Prime City, the Analyst uses Bayes' Theorem to classify messages as spam or not spam. Given the prior probability of spam, the probability of a keyword appearing in spam, and the probability of the keyword appearing in non-spam, the Analyst can compute the posterior probability. "Bayes' Theorem: P(Spam|Keyword) = P(Keyword|Spam) * P(Spam) / P(Keyword)," the Analyst explains. "Where P(Keyword) = P(Keyword|Spam) * P(Spam) + P(Keyword|NotSpam) * P(NotSpam)." Given P(Spam) as a fraction a/b, P(Keyword|Spam) as c/d, and P(Keyword|NotSpam) as e/f, compute P(Spam|Keyword) as a fraction in lowest terms. Output the numerator and denominator separated by a space. Constraints: 0 < a <= b <= 1000, 0 <= c <= d <= 1000, 0 <= e <= f <= 1000, denominator > 0 Input: 1 2 3 4 1 4 Output: 3 4 Input: 2 3 4 5 1 5 Output: 8 9

Constraints:

0 < a <= b <= 1000, 0 <= c <= d <= 1000, 0 <= e <= f <= 1000

Tags:

bayes probability classification math
Loading...
Test Cases:No test cases
No test cases available.