Artificial Intelligence Vs Machine Learning Vs Deep Learning: A Quick Comparison
Tags: machinelearning, deeplearning, ai
Published: 2020-12-20 22:00:28

The buzzwords AI, ML, and DL had always confused me. In fact, I had wrongly used them interchangeably several times. I say wrongly because, now that I understand what each of them means, it's very clear to me that even though they're related, they don't mean the same thing. It took me a bit of research to really understand these three concepts and how they differ. In this piece, I'd be sharing with you my understanding of these terms. Permit me to begin this writing by interrogating the eldest of the three.

# Artificial Intelligence
By way of definition, we could say that artificial intelligence is a field of study that most of my friends are completely disinterested in :)

### Come onnnnn are you kidding me?
Well, not really. While the definition above might come off as a complete joke, there are actually two facts in it:
1. Yes, most of my friends fiercely hate artificial intelligence.
2. Artificial intelligence is a field of study or branch of knowledge.

For now, we would ignore the first fact and pursue the second one. The common denominator to all fields of study is that they answer at least one fundamental question about humanity. For example, Physics tries to unravel how the universe works, History explores the evolution of human cultures and Biology demystifies life. But this begs the question: If AI is a field of study then what fundamental question about humanity does it try to answer? Artificial intelligence tries to answer this one question: *How can we build machines with human intelligence?*

With this understanding of artificial intelligence, we could redefine AI as a branch of knowledge that primarily concerns itself with building machines that could perform tasks that would usually require human intelligence. While endowing machines with human intelligence is a really broad statement, see it as giving machines the ability to learn, build some pool of knowledge/experience from what they've learned, and then use these experiences to solve problems.

### Oh okay, Nyior I get what artificial intelligence is, but the idea of building machines that are as smart as humans sounds really impractical to me. I mean how can this be achieved?
It's simple. I present to you...

# Machine Learning
It is one of the ways artificial intelligence could be achieved. It's centered around the idea that we could endow machines with human intelligence if we give them access to data and allow them to learn from that data.

### what does learning entail you ask?
> “Learning” entails using sophisticated mathematical algorithms to optimize some function called the **predictor function** so that, given input data x about a certain domain (say, square footage of a house), it will accurately predict some interesting value h(x) (say, the market price for the said house).

### Yo Nyior, you're just saying buzzwords oh 😭
*abeg no vex*, let's try to make sense of that fancy definition😅. The key to making sense of the definition above lies in understanding what a predictor function is. Usually, when programmers write code, they are basically just hard coding rules that could be used by the machine to solve a given problem. Most rules in programming are expressed with some mathematical function. However, hardcoding rules for machines is not the machine learning way of building algorithms. In machine learning, we give our algorithm some data and allow them to autonomously discover those rules themselves. Thus, predictor functions are the rule(s) that a machine learning algorithm has to discover.

### How do ML algorithms automatically generate the predictor function you ask?
An ML algorithm is first passed a function that performs really poorly at the task at hand. This could be something like y = theta1 + theta2x. The algorithm then learns by optimizing the initial function it was passed to do better at the given task.  A function formally called the loss function, indicates the degree of the wrongness of a predictor function. Thus, generally, training a model in ML implies calling the loss function to measure the degree of the wrongness of the predictor function after every training data had been passed to the algorithm. In addition, learning in this context simply means exposing an ML algorithm to some data and having it optimize its predictor function. 

# Deep Learning
It is a subset of machine learning. Technically, deep learning is machine learning. It is just the collective name for the revolutionary breed of machine learning algorithms that had recently appeared on the AI scene. ML algorithms under the deep learning umbrella, unlike the traditional ML algorithms; have a logical structure that models the structure and behavior of the human brain. Algorithms that follow this structure are called Artificial Neural Networks(ANNs). 

### But what is this structure you ask?
Deep learning algorithms possess a layered structure that simulates the architecture of the human brain(a network of neurons). In a nutshell, the human brain functions by passing an electrical charge emitted by some neuron to the next neuron. Similarly, deep learning algorithms make computational decisions by accepting some data through the first layer called the input layer, manipulating the data, and then passing its output to the next layer, until it reaches the last layer called the output layer.  ANNs could have one or more layers between the input and output layers. ANNs with more than one layer between the input and output layers are called deep neural networks.

Conclusively, think of AI as this broad concept of building machines that are as smart as humans, machine learning as one practical way of achieving artificial intelligence, and deep learning as the collective name for machine learning algorithms that model the structure and behavior of the human brain.