Click to Consult uses Serverless Backend Solution to better reduce infrastructure cost and implement modernize solution.
Lets get started...!
We will input an email body to the model and it should return
True if the first line of the email body is greeting else it should return
For 7Targets, we wanted to create a model that would remove the salutation line for further processing of emails. To create an ML model you need a dataset on which the model is trained. For our case, we needed a set of emails as a dataset. In our case we used emails we have. We manually classified the emails and marked them if they contained greetings.
Feature Vector Generation
We first split the data into sets of training and testing data with a ratio of 3:1 and chose Random Forest Classifier as the classifier for the project. Trained the model with training data and then tested the model and got accuracy to be 97%. The accuracy was higher than I had expected. Finally, we saved the model into a pickle file using joblib for later use.
How did we use the model?
We had to run real time inference of the data on AWS Lambda, because we use serverless technology a lot. We first created the AWS Lambda Layer from the scikit learn library and used the AWS prebuilt Numpy layer. Wrote the inference code and pushed the pickle file of the model into the Lambda. It worked like a charm and we are now using it in production.
In this article, I have demonstrated the simplest workflow required to develop a machine learning model used to identify salutations in the email.
Though, there are few more improvements that would be required in this model. Like, if there is no newline between the salutation and the email body then the model would not work well. Which we will discuss for a later time.
Hit me up on my email if you have any questions.
Thanks for reading!