Implementing spam detection with Sparkling Water
In this recipe, we'll look at how to implement a spam detector by extracting data, transforming and tokenizing messages, building Spark's Tf-IDF model, and expanding messages to feature vectors. We'll also create and evaluate H2O's deep learning model. Lastly, we will use the models to detect spam messages.
Getting ready
To step through this recipe, you will need a running Spark Cluster in any one of the following modes: Local, standalone, YARN, Mesos. Include the Spark MLlib package in the build.sbt
file so that it downloads the related libraries and the API can be used. Install Hadoop (optionally), Scala, and Java. Also, install Sparkling Water as discussed in the preceding recipe.
How to do it…
Please download the dataset from https://github.com/ChitturiPadma/datasets/blob/master/smsData.txt. The records in the dataset look like the following:
ham Ok... But they said i've got wisdom teeth hidden inside n mayb need 2 remove...