I am looking back at the homeworks and I don't understand something at question 1.b from HW 5. For P(G|Expect online income) we set it to 0 but for P(G|Earn extra cash) we set it to undefined. For me it seems that both have the same problem (that words don't appear in the training set), but the solutions to these two probabilities are note the same. In a case we set it to 0, and in the other to undefined. Is the 0 an error or is there a difference between the two solutions.
Thank you for your answer!
The reason "expect online income" is 0 is that the numerator is 0, but not the denominator. For "earn extra cash", both the numerator and denominator are 0, because "cash" does not occur in the training set at all (for either class). The explanation for the latter is incomplete in the solutions (it should mention both "ham" and "spam"), good catch, will fix!