Machine Learning Classifiers - The Algorithms & How They Work

It used to be that you needed a data science and engineering background to use AI and machine learning, but new user-friendly tools and SaaS platforms make machine learning accessible to everyone.

Machine learning classifiers are one of the top uses of AI technology – to automatically analyze data, streamline processes, and gather valuable insights.

What Is a Classifier?

A machine learning classifier is an algorithm that automatically orders or categorizes data into one or more of a set of “classes.” One of the most common examples is an email classifier that scans emails to filter them by class label: Spam or Not Spam.

Machine learning algorithms are helpful to automate tasks that previously had to be done manually. They can save huge amounts of time and money and make businesses more efficient.

What’s the Difference Between a Classifier and a Model?

A classifier is the algorithm itself – the rules used by machines to classify data. A classification model, on the other hand, is the end result of your classifier’s machine learning. The model is trained using the classifier, so that the model, ultimately, classifies your data.

There are both supervised and unsupervised classifiers. Unsupervised machine learning classifiers are fed only unlabeled datasets, which they classify according to pattern recognition or structures and anomalies in the data. Supervised and semi-supervised classifiers are fed training datasets, from which they learn to classify data according to predetermined categories.

Sentiment analysis is an example of supervised machine learning where classifiers are trained to analyze text for opinion polarity and output the text into the class: Positive, Neutral, or Negative. Try out this pre-trained sentiment analysis model to see how it works.

Test with your own text



Machine learning classifiers are used to automatically analyze customer comments (like the above) from social media, emails, online reviews, etc., to find out what customers are saying about your brand.

Other text analysis techniques, like topic classification, can automatically sort through customer service tickets or NPS surveys, categorize them by topic (Pricing, Features, Support, etc.), and route them to the correct department or employee.

SaaS text analysis platforms, like MonkeyLearn, give easy access to powerful classification algorithms, allowing you to custom-build classification models to your needs and criteria, usually in just a few steps.

Machine learning classifiers go beyond simple data mapping, allowing users to constantly update models with new learning data and tailor them to changing needs. Self-driving cars, for example, use classification algorithms to input image data to a category; whether it’s a stop sign, a pedestrian, or another car, constantly learning and improving over time.

But what are the major classification algorithms and how do they work?

5 Types of Classification Algorithms

Depending on your needs and your data, these top 5 classification algorithms should have you covered.

Decision Tree

A decision tree is a supervised machine learning classification algorithm used to build models like the structure of a tree. It classifies data into finer and finer categories: from “tree trunk,” to “branches,” to “leaves.” It uses the if-then rule of mathematics to create sub-categories that fit into broader categories and allows for precise, organic categorization.

For example, this is how a decision tree would categorize individual sports:

A decision tree classifying sports into "racquet sports" and "bat sports."

As the rules are learned sequentially, from trunk to leaf, a decision tree requires high quality, clean data from the outset of training, or the branches may become over-fitted or skewed.

Naive Bayes Classifier

Naive Bayes is a family of probabilistic algorithms that calculate the possibility that any given data point may fall into one or more of a group of categories (or not). In text analysis, Naive Bayes is used to categorize customer comments, news articles, emails, etc., into subjects, topics, or “tags” to organize them according to predetermined criteria, like this:

Text being tagged as "Sports" or "Not Sports."

Naive Bayes algorithms calculate the probability of each tag for a given text, then output for the highest probability:

Meaning, the probability of A, if B is true, is equal to the probability of B, if A is true, times the probability of A being true, divided by the probability of B being true.

Moving from tag to tag, this calculates the probability that a data point belongs within a certain category or not: Yes/No.

K-Nearest Neighbors

K-nearest neighbors (k-NN) is a pattern recognition algorithm that stores and learns from training data points by calculating how they correspond to other data in n-dimensional space. K-NN aims to find the k closest related data points in future, unseen data.

In text analysis, k-NN would place a given word or phrase within a predetermined category by calculating its nearest neighbor: k is decided by a plurality vote of its neighbors. If k = 1, it would be tagged into the class nearest 1.

Support Vector Machines (SVM)

SVM algorithms classify data and train models within super finite degrees of polarity, creating a 3-dimensional classification model that goes beyond just X/Y predictive axes.

Take a look at this visual representation to understand how SVM algorithms work. We have two tags: red and blue, with two data features: X and Y, and we train our classifier to output an X/Y coordinate as either red or blue.

Red and blue tags on an X/Y axis.

The SVM assigns a hyperplane that best separates (distinguishes between) the tags. In two dimensions this is simply a straight line. Blue tags fall on one side of the hyperplane and red on the other. In sentiment analysis these tags would be Positive and Negative.

To maximize machine learning model training, the best hyperplane is the one with the largest distance between each tag:

An support vector machine showing the ideal hyperplane between red and blue.

As our datasets become more complex, it may not be possible to draw a single line to distinguish between the two classes:

Blue and red clustered in 2D so that they cannot be separated by a straight line.

SVM algorithms make excellent classifiers because, the more complex the data, the more accurate the prediction will be. Imagine the above as a 3-dimensional output, with a Z-axis added, so it becomes a circle.

Mapped back to 2D, with the best hyperplane, it looks like this:

A 2-dimensional hyperplane going through the center of data.

SVM algorithms create super accurate machine learning models because they’re multidimensional.

Artificial Neural Networks

Artificial neural networks aren’t a “type” of algorithm, as much as they are a collection of algorithms that work together to solve problems.

Artificial neural networks are designed to work much like the human brain does. They connect problem-solving processes in a chain of events, so that once one algorithm or process has solved a problem, the next algorithm (or link in the chain) is activated.

Artificial neural networks or “deep learning” models require vast amounts of training data because their processes are highly advanced, but once they have been properly trained, they can perform beyond other, individual, algorithms.

There are a variety of artificial neural networks, including convolutional, recurrent, feed-forward, etc., and the machine learning architecture best suited to your needs depends on the problem you’re aiming to solve.

Put Machine Learning Classifiers to Work for You

Classification algorithms enable the automation of machine learning tasks that were unthinkable just a few years ago. And, better yet, they allow you to train AI models to the needs, language, and criteria of your business, performing much faster and with a greater level of accuracy than humans ever could.

MonkeyLearn is a machine learning text analysis platform that harnesses the power of machine learning classifiers with an exceedingly user-friendly interface, so you can streamline processes and get the most out of your text data for valuable insights.

Try out these pre-trained classification models to see how it works:

  • NPS Survey Feedback Classifier: automatically classify open-ended survey responses into categories Customer Support, Ease of Use, Features, and Pricing
  • Sentiment Analyzer: analyze any text for opinion polarity: Positive, Negative, Neutral
  • Email Intent Classifier: automatically classify email responses as Interested, Not Interested, Autoresponder, Email Bounce, Unsubscribe, or Wrong Person

Or schedule a free demo to see all that MonkeyLearn has to offer.

Tobias Geisler Mesevage

December 14th, 2020