Measuring accuracy

Imagine you are developing a spam filter for a commenting system you've developed for your blog. Spam filters are a type of supervised learning algorithm, as the algorithm must first be told what constitutes spam versus ham. You train your spam system on many examples of ham and spam messages, and then release it into production and allow it to classify all new comments, automatically blocking spam messages and letting genuine ham messages go through.

Let us consider a positive to be a comment that the algorithm identifies as spam (we're calling this positive because we're calling the algorithm a spam filter; this is only a semantic distinction, as we could call the filter a ham filter and instead use positive to denote ...

Get Hands-on Machine Learning with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.