User:Herdrick/sandbox

N-D (1):$$P(\mathrm{nutritious}\;|\;\mathrm{'universities' \wedge 'think' \wedge ...}) =$$

$$\frac{P(\mathrm{'universities' \wedge 'think' \wedge ...}\;|\;\mathrm{nutritious}) P(\mathrm{nutritious})}  {P(\mathrm{'universities' \wedge 'think' \wedge ...})}$$

(2):$$P(\mathrm{nutritious}\;|\;\mathrm{'pemdas' \wedge 'monogamy' \wedge 'silicon' \wedge ...}) = $$

$$\frac { P(\mathrm{'pemdas'} \;|\;\mathrm{nutritious}) \cdot P(\mathrm{'monogamy'} \;|\;\mathrm{nutritious}) \cdot P(\mathrm{'silicon'} \;|\;\mathrm{nutritious}) \cdot ... \cdot P(\mathrm{nutritious})} {P(\mathrm{'pemdas'}) \cdot P(\mathrm{'monogamy'}) \cdot  P(\mathrm{'silicon'}) \cdot ... }$$

(x):$$P(\mathrm{killer}\;|\;\mathrm{roommate \wedge demo}) = \frac{P(\mathrm{roommate \wedge demo}\;|\;\mathrm{killer}) P(\mathrm{killer})}{P(\mathrm{roommate \wedge demo})}$$

-logistic regression:


 * $$\pi(x) = \frac{e^{\beta_0 + \beta_1 x}}{e^{\beta_0 + \beta_1 x} + 1} = \frac {1}{1+e^{-(\beta_0 + \beta_1 x)}}.$$

MNB

 * $$\Pr(\mathrm{nutricious}|\mathrm{universities,think}) = \frac{\Pr(\mathrm{universities,think}|\mathrm{nutricious})\Pr(\mathrm{nutricious})}{\Pr(\mathrm{universities,think})}$$

Naive Bayes
We want to decide how like it is that a message is spam given that it contains the words "free" and "viagra".


 * $$\Pr(\mathrm{spam}|\mathrm{free,viagra}) = \frac{\Pr(\mathrm{free,viagra}|\mathrm{spam})\Pr(\mathrm{spam})}{\Pr(\mathrm{free,viagra})}$$

Since we assume independence of the variables, we can rewrite it like so:


 * $$\Pr(\mathrm{spam}|\mathrm{free,viagra}) = \frac{\Pr(\mathrm{free}|\mathrm{spam})\Pr(\mathrm{viagra}|\mathrm{spam})\Pr(\mathrm{spam})}{\Pr(\mathrm{free})\Pr(\mathrm{viagra})}$$

Which is identical to this:


 * $$\Pr(\mathrm{spam}|\mathrm{free,viagra}) = \Pr(\mathrm{spam})\frac{\Pr(\mathrm{free}|\mathrm{spam})\Pr(\mathrm{viagra}|\mathrm{spam})}{\Pr(\mathrm{free})\Pr(\mathrm{viagra})}$$

---

p (killer | roommate ^ demo ) = p ( roommate ^ demo | killer ) * p(killer) / p (roommate ^ demo)

(1):$$P(\mathrm{killer}\;|\;\mathrm{roommate \wedge demo}) = \frac{P(\mathrm{roommate \wedge demo}\;|\;\mathrm{killer}) P(\mathrm{killer})}{P(\mathrm{roommate \wedge demo})}$$

assume independence of roommate and demo conditional on killer, then $$P(\mathrm{roommate \wedge demo}\;|\;\mathrm{killer})$$ can be (2)$$P(\mathrm{roommate\;|\;killer}) P(\mathrm{demo\;|\;killer})$$

substitute that: (3):$$P(\mathrm{killer}\;|\;\mathrm{roommate \wedge demo}) = \frac{P(\mathrm{roommate\;|\;killer}) P(\mathrm{demo\;|\;killer})P(\mathrm{killer})} {P(\mathrm{roommate \wedge demo})}$$

p (killer | roommate ^ demo ) =   p ( roommate | killer) * p ( demo | killer ) * p(killer) / p (roommate ^ demo) OK, try to "normalize", i.e. do some algebraic manip:

p (killer | roommate ^ demo ) + p ( ~killer | roommate ^ demo ) = 1 i.e.


 * $$P(\mathrm{killer}\;|\;\mathrm{roommate \wedge demo}) +

P(\mathrm{\lnot killer}\;|\;\mathrm{roommate \wedge demo}) = 1 $$

Now substitute from (3):

(4):$$ \frac{P(\mathrm{roommate\;|\;killer}) P(\mathrm{demo\;|\;killer})P(\mathrm{killer})} {P(\mathrm{roommate \wedge demo})} + \frac{P(\mathrm{roommate\;|\;\lnot killer}) P(\mathrm{demo\;|\;\lnot killer})P(\mathrm{\lnot killer})} {P(\mathrm{roommate \wedge demo})} = 1 $$

multiply both sides by the denom of the two complex terms: (5):$$ P(\mathrm{roommate\;|\;killer}) P(\mathrm{demo\;|\;killer})P(\mathrm{killer}) + P(\mathrm{roommate\;|\;\lnot killer}) P(\mathrm{demo\;|\;\lnot killer})P(\mathrm{\lnot killer}) = P(\mathrm{roommate \wedge demo}) $$ So then we have p (roommate ^ demo) in terms of conditional probs that we have (or will take wild ass guesses at)