December 2018
Intermediate to advanced
274 pages
7h 46m
English
In the preceding section, we created our model to classify the messages as spam and non-spam. Now, let's convert that into the Core ML model so that we can use that in an IOS app.
To create a core-ML model, append the following lines to the preceding code and run them. This will create a .mlmodel file:
# importing the libraryimport coremltools# convert to fitted model in to coreml modelcoreml_model = coremltools.converters.sklearn.convert(text_clf, "message", "spam_or_not")#set parameters of the modelcoreml_model.short_description = "Classify whether message is spam or not"coreml_model.input_description["message"] = "TFIDF of message to be classified"coreml_model.output_description["spam_or_not"] ...
Read now
Unlock full access