7 Machine Learning Algorithms to Know: A Beginner's Guide

Written by Coursera Staff • Updated on

Machine learning algorithms power many services in the world today. Discover the top machine learning algorithms to know as you look to start your career.

[Featured image] Two machine learning professionals discuss machine learning algorithms on their computer.

Machine learning (ML) can do everything from analysing X-rays, predicting stock market prices, and recommending television. With such a wide range of applications, it's little surprise that experts anticipate the global machine learning market will grow from $21.7 billion in 2022 to $209.9 by 2029, according to Fortune Business Insights [1]. 

At the core of machine learning are algorithms, which are trained to become the machine learning models used to power some of the world's most impactful innovations. In this article, you will learn about seven critical ML algorithms as you begin your machine-learning journey and explore the different learning styles used to turn ML algorithms into ML models. 

Top machine learning algorithms to know

Machine learning algorithms are the fundamental building blocks for machine learning models. From classification to regression, here are seven algorithms you need to know as you begin your machine learning career:

1. Linear regression

Linear regression is a supervised learning algorithm that predicts and forecasts values within a continuous range, such as sales numbers or prices.

Originating from statistics, linear regression performs a regression task, which maps a constant slope using an input value (X) with a variable output (Y) to predict a numeric value or quantity. Linear regression uses labelled data to make predictions by establishing a line of best fit, or "regression line", approximated from a scatter plot of data points. As a result, linear regression is used for predictive modelling rather than categorisation.

2. Logistic regression

Logistic regression, or "logit regression," is a supervised learning algorithm for binary classification, such as deciding whether an image fits into one class. 

Originating from statistics, logistic regression technically predicts the probability that an input can be categorised into a single primary class. In practice, however, this can be useful for grouping outputs into one of two categories ("the primary class" or "not the primary class"). Creating a range for binary classification, such as any output between 0 and .49 being put in one group and any output between .50 and 1.00 being placed in another, helps achieve this goal. 

As a result, logistic regression in machine learning typically gets used for binary categorisation rather than predictive modelling. 

3. Naive Bayes 

Naive Bayes is a set of supervised learning algorithms that create predictive models for either binary or multi-classification. Based on Bayes' theorem, Naive Bayes operates on conditional probabilities, which are independent of one another but indicate the likelihood of a classification based on their combined factors.

For example, a programme created to identify plants might use a naive Bayes algorithm to categorise images based on certain factors, such as perceived size, colour, and shape. While each factor is independent, the algorithm would note the likelihood of an object being a particular plant using them combined. 

4. Decision tree

A decision tree is a supervised learning algorithm for classification and predictive modelling. 

Resembling a graphic flowchart, a decision tree begins with a root node, which asks a specific question of data and then sends it down a branch depending on the answer. These branches each lead to an internal node, which asks another question of the data before directing it toward another branch, depending on the answer. This continues until the data reaches an end node, called a leaf node, and doesn't branch any further. 

Decision trees are common in machine learning because they can cheaply handle complex data sets. 

5. Random forest algorithm

A random forest algorithm uses an ensemble of decision trees for classification and predictive modelling. 

In a random forest, many decision trees (sometimes hundreds or even thousands) are each trained using a random sample of the training set (a method known as "bagging"). Afterward, researchers put the same data into each decision tree in the random forest and tally their results. The most common result becomes the most likely outcome for the data set.

Although they can become complex and require time, random forests correct the common " overfitting " problem with decision trees. Overfitting is when an algorithm coheres too closely to its training data set, negatively impacting its accuracy later when introduced to new data. 

6. K-nearest neighbour (KNN) algorithm

A K-nearest neighbour is a supervised learning algorithm for classification and predictive modelling. 

True to its name, KNN algorithms classify an output by its proximity to other outputs on a graph. For example, if an output is closest to a cluster of blue points on a graph rather than a cluster of red points, it would be classified as a member of the blue group. This approach means that KNN algorithms can classify known outcomes or predict the value of unknown ones.

7.  K means algorithm

K means an unsupervised algorithm used for classification and predictive modelling. 

Much like KNN, K means the proximity of an output to a cluster of data points to identify it. A centroid, a real or imaginary centre point, defines each cluster. K means it is useful on large data sets, especially for clustering, though it can falter when handling outliers. 

Training machine learning algorithms: Four methods

Everyone learns differently – including machines. In this section, you will learn about four different learning styles used to train machine learning algorithms: supervised learning, unsupervised learning, reinforcement learning, and semi-supervised learning. 

Supervised learning

A supervised learning algorithm uses a labelled data set to train an algorithm, effectively guaranteeing that it has an answer key available to cross-reference predictions and refine its system. As a result, supervised learning is best suited to algorithms with specific outcomes, such as classifying images.

For example, you could train an algorithm to identify different plant types using images already labelled with their names (e.g., "rose," "pumpkin," or "aloe vera"). Through supervised learning, the algorithm could then effectively identify the differentiating features for each plant classification and eventually do the same with an unlabelled data set. 

Much as a teacher supervises their students in a classroom, the labelled data likewise supervises the algorithm's solutions and directs them toward the correct answer. 

Unsupervised learning 

An unsupervised learning algorithm uses an unlabelled data set to train an algorithm. The algorithm must analyse that data to identify distinctive features, structures, and anomalies. Unlike supervised learning, researchers use unsupervised learning when they don't have a specific outcome. Instead, they use the algorithm to cluster data and identify patterns, associations, or anomalies. 

For example, a business might feed unlabelled customer data to an unsupervised learning algorithm to segment its target market. Once it has established a precise customer segmentation, the business could use this data to direct future marketing efforts, such as social media marketing. 

Unsupervised learning is akin to a learner working out a solution themselves without the supervision of a teacher. 

Reinforcement learning 

In reinforcement learning, a machine or AI agent attempts to accomplish a task, receives feedback as it does so, and then iterates a new approach until it has devised the optimal solution. As a result, reinforcement learning is akin to how a child learns to manoeuvre a new environment: first, they explore, then interact with it, and over time learn how to manoeuvre the space seamlessly. 

Due to the feedback loops required to develop better strategies, reinforcement learning is often used in video game environments with controllable conditions and reliable feedback. Over time, the machine or AI learns through the accumulation of feedback until it achieves the optimal path to its goal. 

Semi-supervised learning

Semi-supervised learning (SSL) trains algorithms using a small amount of labelled data alongside a more significant amount of unlabelled data. It is often used to categorise large amounts of unlabelled data because labelling all data itself might be unfeasible or too difficult. 

Typically, a researcher using SSL would first train an algorithm with a small amount of labelled data before training it with a large amount of unlabelled data. For example, you might first train an SSL algorithm analysing speech on labelled soundbites before training it on unlabelled sounds, which likely vary in pitch and style from the labelled data. 

Learn more about machine learning. 

A career in machine learning begins with learning all you can about it. Even the best machine learning models need some training first, after all. 

To start your training, consider taking Andrew Ng's beginner-friendly Machine Learning Specialisation to master fundamental AI concepts and develop practical machine learning skills. Meanwhile, AI's Deep Learning Specialisation introduces course takers to methods and concepts for building and training deep neural networks. 

Article sources

  1. Fortune Business Insights. "The global machine learning (ML) market is expected to grow from $21.17 billion in 2022 to $209.91 billion by 2029,  https://www.fortunebusinessinsights.com/machine-learning-market-102226". Accessed May 17, 2024. 

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.