# How to use Machine Learning to classify support emails in Python source: https://developer.mastercard.com/blog/email-classifier/index.md Authors: Akshay Dubey. The development teams across Mastercard that publish their APIs on developer.mastercard.com often have questions about the API onboarding process. The Mastercard Developers Standards and Consultancy team are responsible for supporting them and they are the ones who triage the queries and respond to them. Akshay Dubey, one of the software engineers on the Standards and Consultancy team, saw an opportunity to automate how they categorize and prioritize these queries so they could direct them to the right people on the team as well as analyze the queries to look for common issues and improvements. He applied his data analytics background to the problem and then created a handy video to showcase the processes and tools that he used. This short video will show a practical approach taken by a data scientist to solve a classification using machine learning. In it, Akshay uses supervised machine learning to train the dataset and predict the result and assess the results from the different algorithms so he can select the one that works best for his purposes and dataset. It starts with how to gather and clean the data using pre-processing techniques like lemmatization, stemming, and removing characters, punctuation and words that don't contribute to the models. The goal is to make sure the data that is fed into the algorithms is accurate, of good quality, and minimal. Then Akshay walks through how he trains and tests the data by splitting the data into training and testing subsets and using Term Frequency -- Inverse Document Frequency (TF-IDF) technique which is a statistical measure that evaluates how relevant a word is to a document in a collection of documents. The video then covers the supervised machine learning algorithms used: Support Vector Classification (SVC), Naïve Bayes (NB), and K-Nearest Neighbors (KNN). Akshay also shows how to use the Hyperparameter Tuning method through the Grid Search CV technique and Randomized Search Cross Validation technique to control how the parameters are adjusted to improve the results of each model. Once we have results from the three models, Akshay details how he compared them using the Precision, Recall, F1-Score, and Support scores and the Confusion Matrix to visualize the data. He compares the labelled category against the predicted category to measure the effectiveness of each model and also analyzes the miss-classified data to see if there is scope for improvement. Finally, he creates a dashboard of various charts to compare the three different models. Video Timeline: Introduction 01:36 Gathering and cleaning the data 05:53 Train and test the data 09:36 Machine Learning algorithms used 15:05 Comparing the three Machine Learning algorithms 18:26 Visualization and comparison of the different models Resources You can download the source code shown in the video from GitHub here.