types of machine learning introducing naive bayes classifiers in the context of spam filter not every email you receive has honest intentions your inbox can contain unsolicited commercial or bulk emailsa spam not only is spam annoyingit' often used in scams and as carrier for viruses kaspersky estimates that more than of the emails in the world are spam to protect users from spammost email clients run program in the background that classifies emails as either spam or safe popular technique in spam filtering is employing classifier that uses the words inside the mail as predictors it outputs the chance that specific email is spam given the words it' composed of (in mathematical termsp(spam wordsto reach this conclusion it uses three calculationsp(spam)--the average rate of spam without knowledge of the words according to kasperskyan email is spam of the time (words)--how often this word combination is used regardless of spam (words spam)--how often these words are seen when training mail was labeled as spam to determine the chance that new email is spamyou' use the following formulap(spam|wordsp(spam) (words|spamp(wordsthis is an application of the rule ( |ap(bp( |bp( )which is known as bayes' rule and which lends its name to this classifier the "naivepart comes from the classifier' assumption that the presence of one feature doesn' tell you anything about another feature (feature independencealso called absence of multicollinearityin realityfeatures are often relatedespecially in text for example the word "buywill often be followed by "now despite the unrealistic assumptionthe naive classifier works surprisingly well in practice with the bit of theory in the sidebaryou're ready to perform the modeling itself make sure to run all the upcoming code in the same scope because each piece requires the one before it an ipython file can be downloaded for this from the manning download page of this book the mnist images can be found in the data sets package of scikit-learn and are already normalized for you (all scaled to the same size pixels)so we won' need much data preparation (step three of the data science processbut let' first fetch our data as step two of the data science processwith the following listing listing step of the data science processfetching the digital image data from sklearn datasets import load_digits import pylab as pl digits load_digits(imports digits database loads digits kaspersky quarterly spam statistics reportspam-statistics-report- - vvym blviko