Technical requirements

To create a model to classify a message as spam or non-spam, we need a library that is capable of doing so. Here, we've selected scikit-Learn.

To write this application, you need to have the Python3+ version installed on your desktop, and Xcode 9+ must be installed on your Mac machine. If you don't have either of these, please check the appendix of this book to learn how to get them. Once you have installed Python in your machine, execute the following commands to get the required packages:

pip install scikit-learn 
pip install numpy
pip install coremltools
pip install pandas

Using the preceding code, we installed scikit-learn to get access to the algorithms and NumPy as the scikit-learn requires it, and pandas (pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming) to read the model from the file and core-ML tools to generate a Core ML model file.

Now, download SMSSpamCollection.txt, a plain text file from the model link stated in the preceding section, onto your disk and put it in your project folder.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset