Logic and implementation of a spam filter machine learning algorithm