An Introduction to Machine Learning –The Magic behind Artificial Intelligence

Mikhail Szugalew
6 min readJan 4, 2019


Photo by Franck V. on Unsplash

Machine Learning algorithms are some of the most important developments in recent history. They allow us to create powerful Artificial Intelligence (AI) programs that perform tasks such as natural language processing (NLP) and image classification with remarkable accuracy.

When it comes to understanding what Machine Learning really is, Arthur Samuel provided a good intuition based definition all the way back in 1959.

“Machine Learning is the field of study that gives computers the ability to learn without being explicitly programmed.”

It’s debatable whether or not the computer is actually learning, but what this definition tells us is that using Machine Learning we can make computers teach themselves complex patterns in data allowing us to create AIs without explicitly programming them.

Therefore, we can build complex programs like ones for image classification without having to directly come up with algorithms that account for all the various factors!

This intuition is a good start and it gives a good understanding of why ML is important but it’s not very good at explaining how ML is applied.

A more specific and applicable definition of ML was provided more recently in 1998 by Tom Mitchell.

“Machine Learning is when a computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E.”

Yeah, I know that’s a somewhat long and confusing sentence. But let’s try applying this logic to a common ML problem, classifying emails as spam and not spam.

  • The Experience E -> The data set of emails you give the program
  • The Task T -> Classifying the emails as spam and not spam
  • The Performance Measure P -> The accuracy of how it classifies the emails

This email classifier would be an example of a supervised learning classification algorithm. However, this is not the only type of ML algorithm.

There are 3 main types of Machine Learning Algorithms

  1. Supervised Learning
  2. Unsupervised Learning
  3. Reinforcement Learning

Supervised Learning

The main idea behind supervised learning is that you provide the computer with a data set of input examples, each with a correct/corresponding output example. From this dataset, the ML algorithm then derives a correlation that connects the examples to the answers.

This correlation (commonly referred to as the hypothesis or model) can then be used to make predictions on new examples the program hasn’t seen before, therefore allowing an answer to be predicted based on a given input.

This type of ML is a lot like when a teacher gives their student problems with answers, and then from that, the student figures out how to solve for the correct answer on new problems.

This is probably the most common type of ML problem and it can be further divided into two categories, Regression problems and Classification problems.

Regression problems

These are when your desired possible outputs are connected, continuous and/or on a range.

For example, let’s say we’re given a person’s height and we want to predict their shoe size on the basis of their height. This is a regression problem because the possible outputs are continuous. Imagine a number line where the answer can be any possible number between the smallest shoe size and largest.

The trendline on the above graph represents the hypothesis found by an ML algorithm. The data points represent the training data.

Classification problems

These are when the possible outputs are discrete values. Think true or false, yes or no, dog or cat.

For example, let’s say we are given a patient with a tumour and we want to predict if the tumor is malignant or benign. This would be a classification problem because the output is a discrete value of either malignant or benign. (You can’t have semi malignant or a quarter benign. It’s either one or the other.)

With Supervised Learning, if you remember that regression problems try to derive a number/value from an input and classification problems try to put the input into a category, it’s easy to remember and differentiate between the two.

Unsupervised Learning

With Supervised Learning, we use data sets that have examples connected to answers. Unsupervised learning is used when all you have is the examples and no answers.

The purpose of Unsupervised Learning is to discover correlations and patterns in data and then organize the data based on those findings.

Unsupervised Learning algorithms are commonly used to discover patterns and correlations in data sets collected by companies. For example, a very useful implementation of Unsupervised Learning would be in market segmentation.

Using customer datasets, computers, and unsupervised learning, companies can group together different market segments and demographics to better understand who they’re selling to.

This also happens to be an example of a clustering algorithm because it is able to organize the data into smaller clusters.

Clustering Algorithms

A clustering algorithm takes a data set and then based on variables and correlations it tries to group the dataset into smaller groups (or clusters) of related data points.

An interesting application of this is it could help us better understand our genetics by automatically grouping different genes into groups that are related by different variables.

Clustering algorithms can be used to find groups in datasets

Reinforcement Learning

Reinforcement Learning (RL) is used to teach software agents how to act in an environment to achieve some sort of reward or goal.

Basically, how it works is the computer program analyses its current situation and tries different things. If the thing it tried was beneficial (as determined by the programmer) the program gets artificially rewarded making it more likely to do that thing again. However, if the thing it tried was bad, the program gets penalized and is less likely to do it again.

Eventually, this optimizes a software agent to perform very well at achieving a desired outcome in a certain environment.

This is very analogous to how we train/teach pets or even little children. For example, think about how someone might teach a dog to sit. After they say sit, if the dog sits it’ll get a treat making it more likely to do that again. However, if the dog doesn’t sit, it will learn that it misses out on a treat making it less likely to not sit the next time.

This method happens to be an extremely successful way to train things like video game AIs. By telling the program to maximize its score and allowing it to learn what makes its score go up or down in the given environment (the game), the program can become very good at winning.

Using RL we can create AI opponents for games that can beat even the best human players. However, RL can be applied in any discipline that involves creating an AI that maximizes a certain desired output or reward from a situation.

Key Takeaways

  • Machine Learning is how we make AIs and analyze data
  • Without Machine Learning smart assistants and other important technologies like image recognition and voice recognition wouldn’t be possible
  • Without Machine Learning data analysis would be significantly more difficult
  • There are 3 different approaches to handling data for Machine Learning programs
  1. Supervised Learning
  2. Unsupervised Learning
  3. Reinforcement Learning
  • Each one has specific use cases where it can be best applied

Before you go!

  1. Clap this article
  2. Share it with others who might benefit
  3. Connect with me on LinkedIn