DEV Community

Cover image for AI 101 | Introduction to Artificial Intelligence

AI 101 | Introduction to Artificial Intelligence

muizalvi profile image Muiz Alvi Updated on ・16 min read


If you are someone who is intrigued by self-driving cars, androids that can converse fluently or software that can diagnose tens of thousands of patients in a matter of minutes then artificial intelligence is the field for you!


This post covers basic components of the field, goes over the optimal learning path to take and includes a number of resources to help get you started. So no need to worry about all those complicated terms, super lengthy videos and numerous courses available online. Just follow this post and observe as we simplify AI for you!


Table of Contents

About this Post

This post covers content discussed in the AI 101 | Introduction to Artificial Intelligence hands-on online workshop conducted by Microsoft Learn Student Ambassadors - Islamabad, Student Ambassadors Club - Karachi and NUST ACM Student Chapter.


If you prefer watching the recording for the session, it is available here.

Note: You do not need to watch the recording to understand this post, the link has only been provided for learning purposes.

Learning Objectives

  • Understanding the applications of AI
  • Understanding & differentiating AI components
  • Implementing a Basic AI classifier (Hands-on)
  • Discussing Learning Paths & Resources
  • Understanding Cloud Technologies in AI
  • Discussing Opportunities in AI

What is Artificial Intelligence?

We are living in the modern age of problem solving where we have based entire fields on ideas of science and mathematics to identify and solve problems. Artificial Intelligence, although an extremely broad term, can be thought of as a means of using Computers to solve problems or make automated decisions for tasks that, when done by humans, typically require intelligence.


A classic example would be shape identification. The following picture contains a few shapes that can easily be identified by a toddler.


So this task requires some degree of intelligence and hence if a computer program were able to do it, we could say it does so using artificial intelligence!

The Power & Uses of AI

Shape identification was pretty impressive back in the 1990s, but the applications of AI have grown ever since that time. Decades of research and technology have allowed us to do things that were once considered impossible! Let us dive into the vast capabilities of this field.

The following is a short video of a humanoid robot called Sophia being interviewed by the Stylist Magazine.

Now a lot of people have this confusion that AI refers to such robots (like Sophia) that can, to an extent, mimic human brain functionality to produce abstract thought. When this is entirely false. Robots, like Sophia, make use of an AI backend that allow them to indulge in conversation, this is regardless of a humanoid exterior.

So what exactly are the applications of AI other than robotics? Well, here are a few to help you get started:

Data Processing & Cleaning

Corporate giants maintain tens of thousands of customers' data on a daily basis. Now this task can be both tedious and prone to error if assigned to employees, instead they opt for an AI solution to learn certain patterns and trends overtime to clean or process incorrect, incomplete, irrelevant, duplicated, or improperly formatted customer data.

Speech Recognition


Ever used Siri, Alexa, Google Assistant or any voice-activated piece of technology? Ever wondered how a machine that communicates in binary (1's and 0's) is able to understand you? Well, the answer is the vast field of speech recognition. Here, an AI is trained to understand commands, phrases and even words! Speech recognition is used immensely and almost everywhere, from virtual assistants in our phones, to biometric verification for security purposes and even online banking!

Natural Language Processing

This powerful field of AI involves analyzing human language and deriving understanding based on language structure and context.

For example in the fill-in-the-blank: Man is to Woman what King is to ____, We as humans know that the most suitable replacement to the blank would be Queen, as it gives us a good analogy statement. This is what we are trying to teach our AI as well and can be done by training it on huge amounts of linguistic data.

Applications of this field include the predictive keyboard.


Image Processing & Transformation

Many amazing artworks have effortlessly been created with the help of AI in this field. Below is an example of convolving a picture of a dog with Vincent van Gogh's famous Starry Night.


For further clarity, an AI is needed to extract the essence of both pictures and put them together.

Computer Vision

This field makes use of the ideas behind object detection and identification in images to make applications like self-driving cars a reality.


As seen in the image above, an AI has successfully identified each object and can now make decisions based on this. Incase of a self driving car, it will either go or stop depending on the number and position of people on the street.

Components of AI

Artificial Intelligence has been around for a while now and modern breakthroughs in technology have allowed for greater advancements in this field. Using ideas of Machine Learning and Deep Learning, we are now able to achieve the extraordinary. As you can observe in the diagram below, Machine Learning, or ML, and Deep Learning, or DL, are simply the subfields of AI, which will be discussed to some extend in this post.


So how should one go about studying this field? Maybe you are someone who wants to start with AI, maybe you are stuck on ML or perhaps confused as to where to go when done with DL? Should you start with DL, then go to ML and only then learn about the broader field of AI? With so much content out there, one can get quite confused about which learning path to take. So to make things easier, I'll be sharing my learning path here. It may not be the best path to take but it will give you a structure while studying for AI.

Recommended Learning Path

  • Learn Python
  • Study Classic Machine Learning Examples
  • Make use of Deep Learning Libraries
  • Implement Cloud Technology Practices

Note: Key-elements of this learning path will be discussed throughout this post.

Python Learning Resources

Python is a powerful programming language that will allow us to create our AI models. We choose python because it allows us to make use of many Deep Learning libraries that can make programming much more easier. More on that when we talk about Deep Learning.

Follow these resources to get command on this language in no time! Also, if you are someone that is proficient in another language like C, C++, Java etc. then the learning process will be easier for you.

Resource 1: Watch Python in Action

The following is a video by howCode and goes over all the basics of Python in just 5 minutes!

Resource 2: Signup for HackerRank

Programming requires practice and this website has a ton of python-related problems for you to solve and help improve your skills for free.


You can signup here.

Resource 3: Python Repository

The following GitHub repository contains python problems taken from HackerRank along with solutions. You can make use of the code here for learning and evaluation purposes.

Logic & Rules-Based Approach

Remember this diagram?


You've already been made familiar with the Machine Learning and Deep Learning subsets of this field, but what about the portion of AI that is not enclosed by either subset? Well, that is the part of AI that makes use of a logical and rules-based approach, and by that we simply mean if-else statements!

There was this meme that circulated back in 2014:


So how accurate is this statement anyways? can we create AI using simple if-else statements? Well the answer is yes, we can do that but this comes with a lot of limitations.

First of all, to program an AI like Sophia one would have to write about 50,000 such statements, which is quite laborious. Secondly, it would take a processor quite a lot of time to execute such a code, making it quite inefficient as well.

So is there a way to make use of this approach? Yes! Some Deep Learning models make use of this method by combining if-else statements with Object Oriented Programming. Here is a sample code to help your understanding:

if (road.people == None):
Enter fullscreen mode Exit fullscreen mode

In this program, the car only moves when people are not seen on the road.

So in conclusion, If-else Statements are a very limited approach to solving AI problems.

Intro to Machine Learning

Now let us move towards a more refined version of AI, known as Machine Learning. In this subfield, we make use of algorithms that find patterns in data and infer rules on their own. So what do we mean by learning through data? Well let's first look at the way us humans learn. Consider the picture below:


In this image, we are able to identify the animal on the left as a 'dog' and on the right as a 'cat'. Ever wondered how we were able to do this? Well chances are that you have seen multiple cats and dogs in real life, books or on television etc. and are now able to identify them with ease. Machine Learning works in a similar way, we give a program some data and tell it to learn features (like whiskers, ear size etc.) it then adjusts its learnable parameter(s) according to this data and only then is made able to produce a desired output. More on learnable parameters in the following example.

First AI Classifier (hands-on)

Now let us try to build our first AI classifier. Read the problem statement below to understand what we are trying to build:

Problem Statement:

A computer is given a dataset of 'labeled' animal heights to help train its learnable parameter 'x'. Once trained, the computer will be given a height value and will have to determine whether this height belongs to a 'cat' or 'dog'

Algorithm: When the computer receives a height value greater than x, it outputs 'dog' and if less than or equal to x then it outputs 'cat'



Now before moving towards the code, you should first try to figure out the unknown label for the 50 cm height on your own. (Hint: It will help to write down all heights and labels in ascending order). Once done, follow the steps below to create your first AI classifier:

Step 1: Create Data Variables & Lists:

data = [20, 60, 25, 18, 40] 
label = ['cat', 'dog', 'cat', 'cat', 'dog']
Enter fullscreen mode Exit fullscreen mode

The code above is our training data taken from the table in the problem statement. Each data and label has been placed in a list in respective order. Our program will learn from this data.

x = 0 # learning parameter
H = 50 
Enter fullscreen mode Exit fullscreen mode

We have now initialize our learnable parameter 'x'. The program will set the value of x according to our data. The variable 'H' is the height of the animal we need to classify.

Step 2: Train the Program

The code snippet below simply sets a value for 'x' on the basis of our data and labels being used.

for i in range(0, len(data)): 
    if (data[i] > x) & (label[i] == 'cat'): x = data[i]
Enter fullscreen mode Exit fullscreen mode

When you are done running this code, the optimum value of 'x' will have been set.

Step 3: Test the Program

This is a simple if-else statement that compares 'H' with 'x' and determines whether the animal is a 'cat' or 'dog' based on its height.

if x <= H: print('dog') 
else: print ('cat')
Enter fullscreen mode Exit fullscreen mode

Based on the data the output should be dog.

Ands that's it! you have successfully built, trained and tested your first AI classifier! Now the learning outcome here is that a model extracts features from data and sets its learnable parameter according to these features. It then uses its learnable parameter to predict outcomes on test data.

Full Code

This is what the final form of your code should look like after completing all the steps. I have added comments as well for better understanding.

# Training

data = [20, 60, 25, 18, 40] # Training dataset 
label = ['cat', 'dog', 'cat', 'cat', 'dog'] # Training dataset labels

x = 0 # initial value for x
H = 50 # Test data

for i in range(0, len(data)): 
    if (data[i] > x) & (label[i] == 'cat'): x = data[i]

# Testing

if x <= H: print('dog') 
else: print ('cat')
Enter fullscreen mode Exit fullscreen mode

Classic Machine Learning

Machine Learning has been around for quite sometime now. We know that Deep Learning is a subset of ML, so let us discuss the part of ML that does not fall in the DL category. Namely the 'Classic' version of ML.


I would now like to ask you a question. Was the above AI classifier an example of Classic Machine Learning?

The answer is no. This is because of Tom Mitchell's modern definition of ML: "A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E." In our classifier, the program lacks a performance measure and so is not an example of Machine Learning. It was only presented to give you an idea about how computers learn.

Classic Machine Learning follows the same principles: it extracts features from data, adjusts its learnable parameters (i.e. weight and bias) but also accounts for performance. In layman's terms this means that our program is learning through its mistakes. We will not go into how this works or, the math behind this learning, as it is beyond the scope of this post, this is an introductory post after all, but I hope the example gave you some basic intuition about how ML works.


There are many applications of Classic Machine Learning. Cooperate giants make use of spam filters that train on spam emails, learn words like 'Nigerian prince' or 'free survey' overtime and filter out such emails. Allowing for a cleaner workspace.


Another application is image classification, which will be discussed in detail later in this post.


The best way to start with ML would be with a course by Andrew NG available on Coursera. This is a free course and covers topics related to ML extensively. You can check it out here.

For people already done with ML courses and wish to strengthen their ML concepts with some intro to DL, there's this DeepLizard playlist covering fundamentals for both ML and DL. You can find this playlist here.

Intro to Deep Learning

Deep Learning is a sub-field of Machine Learning that allows for us to overcome limitations of Classic Machine Learning and train powerful models with revolutionary applications. This field makes use of Neural Networks (shown below) for calculations and is quite GPU intensive.


In the diagram above, each circle represents a node and each column of nodes represent a layer. Check out the Build your first Neural Network with the Keras API tutorial to learn all about Neural Networks and their implementation.

Machine Learning vs. Deep Learning

If you are someone who understands the concepts of ML and DL but aren't exactly aware of the technical differences between both. Then this section is just for you! Let us look at the differences between the approach taken by both subfields by the help of an image classification example. The following is a picture of me taken a few weeks ago. Our models will try to train themself on this image.


Machine Learning Approach

An ML model will first extract features, for instance face shape and distance between pupils relative to distance between forehead and chin.


The model will then adjust its learnable parameter according to these features.

Deep Learning Approach

A DL model, on the other hand, takes the image as a whole and passes it through a Neural Network. The Neural Net for our problem looks like this:


This Network has been programmed to slice up an image and take each slice as an input for each input node (nodes on the left most side). The image will be split as follows:


Now each input node will extract some feature from each slice on its own and pass it to the next node to find out another feature and so on. The nodes are learning the features on their own. These features could be anything, like hair color, eye shape, lip shape and so on. This is exactly why DL is GPU intensive, as each node is carrying out complex calculations to extract and learn features. This is also why DL models are far more accurate as compared to ML models.

More on Deep Learning

The applications of DL include self-driving cars, object detection algorithms (like the one discussed above) and Deepfakes.

The most efficient way for you to create DL models is simply by implementing certain Python libraries in your code. These libraries make it super easy to build, train, validate and test your Deep Learning models. Examples of such libraries are tensorflow, keras, pytorch and


You can access these libraries and many more using Anaconda. You can learn all about acquiring Anaconda and installing DL libraries in the Setting up Python environments using Anaconda tutorial.


You can also check out the Deep Learning Specialization course by Andrew NG available on Coursera. This is a powerful five-course specialization that covers DL in great detail. However it is not free but you can apply for financial aid if necessary. Check out the course here.

Another recommended course would be a video series by that covers the use of the python library. This series has eight videos and you can check them out here

Deep Learning Models

The following GitHub repository contains a number of DL Models that you can make use of according to your liking. I have created this repo for people studying math intensive DL courses to be able to see the programs in action. It contains actual image classifiers made with python libraries.

GitHub logo MuizAlvi / Machine_Learning_and_Deep_Learning_models

Repository containing models based on ideas of Machine learning and Deep learning


Repository containing models based on ideas of Machine learning and Deep learning. List of files:

  1. Simple Sequential Model

    • Uses randomly generated trainin set (10% of which is used in validation set) and test data
    • Shows final predictions in a confusion matrix
  2. Cat and Dog Classifier - Convolution Neural Network

    • Uses a data set of 1300 images (1000 for training set, 200 for validation set, 100 for test set) randomly picked out of a larger data set of 25000 images
    • Image Data: (25000 images of cats and dogs)
    • Model experiences overfitting and needs to be improved
    • Model has not been tested for now due to overfitting on the training set
  3. Cat and Dog Classifier 2.0 [using existing model] - Convolution Neural Network

    • Trains existing model VGG16 (with some alterations)
    • Uses data prepeartion used in the previous upload (Cat and Dog Classifier - Convolution Neural Network)
    • Highly accurate model with…

Theoretical & Hands-on Notebooks

Although videos, books and courses are a great source of learning, fields like AI require a more hands-on approach. The following repository contains a number of jupyter notebooks to help further your understanding of ML and DL. It also includes the code to the AI classifier example along with a number of resources to guide you on the path of Artificial Intelligence.

GitHub logo MuizAlvi / AI101

Repository containing guidance material for participants attending the AI101 Workshop


Repository containing hands-on, open-source, practise notebooks for participants attending the AI 101: Introduction to Artificial Intelligence Workshop.

List of files:

  • Workshop Resources

    • Resources.txt
  • Workshop Example:

    • Feature Classifier Example
  • For Machine Learning:

    • 01 - Data Exploration
    • 02 - Regression
    • 03 - Classification
    • 04 - Clustering
  • For Deep Learning:

    • 05a - Deep Neural Networks (PyTorch)
    • 05a - Deep Neural Networks (TensorFlow)
    • 05b - Convolutional Neural Networks (PyTorch)
    • 05b - Convolutional Neural Networks (Tensorflow)
    • 05c - Transfer Learning (PyTorch)
    • 05c - Transfer Learning (Tensorflow)

Note: Please do make use of these notebooks as they will improve your understanding and learning.

Problems with ML & DL

Classic Machine Learning comes with a number of limitations. These limitations are highlighted in the image classification problem discussed above as well.

The problem with Deep Learning is that it is GPU intensive (as mentioned several times above), requires huge amounts of training data and has a very complicated code.

Cloud Services: Microsoft Azure

Microsoft Azure is your one-stop-shop solution to all the above mentioned problems.


Azure provides:

  • Virtual Machines that do complex computations for you!
  • Cloud storage space to store your models and datasets
  • Open datasets that you can use to train your models
  • Automated ML (drag and drop), so you don't event have to code anything!

Now a lot of individuals hesitate to use this platform because it's a paid service, but there is a way around this!

Azure Free Credits

I will be listing down two ways to obtain free Azure credits to help you get started on the platform:

  1. You can get $200 worth of free Azure credits simply by signing up for an Azure account here.
  2. You can obtain $100 worth of free Azure credits and much more by applying for the GitHub Student Developer Pack here.


Now the question you're probably asking yourself is how much can be done with this amount of free credits? Well to answer your question, I built, trained, tested and deployed an ML and a DL model on Azure and that only cost me $0.64! You can see the details below:


So either package is more than enough to for learning purposes.


AI is a powerful field with immense research and implementation opportunity. You should now have a good idea about this field, its subfields and the possible path to take when it comes to learning. If you are someone starting out with AI then please feel free to make use of the provided resources as they will help you on your journey immensely. I would also urge you to share this post in your circle as well, as it addresses a lot of issues faced by people in the AI learning process. It's all here, we just need to get the word out.

DL is a superpower

The picture above is reference to Andrew NG's Deep Learning Specialization course where he tells us that DL is no less than a super power and it is our job to make the best use of it.

I hope the post was clear and covered everything. Please use the discussion/comment section to let me know if you faced any difficulty or have any questions.

Thank you for taking the time to read this article!

Discussion (4)

Editor guide
dastasoft profile image

Is worth to mention that for the Javascript folks all of this is available with TensorFlow.js.

Great article!

muizalvi profile image
Muiz Alvi Author

Yes, that is an excellent point. I would also recommend programmers who create Deep Learning models with ease using Java to stick to that, but for people who are starting out with Deep Learning (DL), or even Machine Learning (ML), it is better to switch to Python as:

  1. Many DL libraries like Keras are written in Python and so have limited support outside this language.
  2. Python ML and DL resources (courses, videos etc.) are both greater in number and more readily available as compared to resources in JavaScript.

That is not to say that Java is not in demand or that people should not opt for it. However for people starting out, I would recommend switching to Python. As I myself was taught C and C++ in the classroom and choose to learn Python on my own when I was starting out and I am quite content with this decision.

anumzehraa profile image

This article is perfect for a beginner. A great read!

muizalvi profile image
Muiz Alvi Author

Thank you so much and I'm glad you enjoyed it!!