Skip to main content

Chapter 1: Introduction to AI and Data Science

MODULE 1 | WEEK 1​

Chapter 1: Introduction to AI and Data Science

In this chapter we start completely from zero. You do not need to know any coding or have any technical background. We will understand what AI is, what Data Science is, why they matter, and what steps a data science project goes through (called the Data Science Pipeline ).

1.1 What is Artificial Intelligence (AI)?​

Artificial Intelligence means making a computer or machine able to do tasks that normally require human intelligence, such as seeing, hearing, understanding, learning, making decisions and talking.

The Two Big Types of AI​

TypeMeaningExample
Narrow AI (Weak AI)Does only one specific task well. All of today's AI is of
this type.
Face unlock, Netflix/YouTube
recommendation, Google Translate, spam
email filter, ChatGPT
General AI (Strong AI)Can learn and understand any kind of task like a
human. Right now it exists only in research and science
fiction, not in reality.
The movie robot that can do anything a
human can

Remember this: today's AI does not "understand" the way humans do. It finds patterns (things that repeat) in data and makes predictions based on them.

Everyday Uses of AI (that you see every day)​

  • Phone: Face unlock, voice assistant, the camera's portrait mode.

  • Social media: Why YouTube/TikTok/Instagram show you the videos you end up liking.

  • Online shopping: "You may also like this" suggestions on Daraz.

  • Banking and mobile wallets: Catching suspicious (fraudulent) transactions.

  • Maps: Google Maps estimating how long a trip will take because of traffic.

  • Health: Predicting a disease from an X-ray or a picture of the skin.

1.2 AI vs Machine Learning vs Deep Learning​

These three terms are often used in place of one another, but they are different. Think of them as circles nested inside each other.

AI (the biggest circle)
|
+-- Machine Learning (inside AI)
|
+-- Deep Learning (inside ML)
|
+-- Generative AI / LLMs (built on DL, like ChatGPT)
TermSimple meaningExample
AIThe big goal of making machines smart. It also includes rule-
based approaches.
A chess program whose rules are
written by hand
Machine Learning (ML)The machine looks at data and learns the rules itself; we do
not have to write every rule.
Predicting next month's sales by
looking at past sales
Deep Learning (DL)The part of ML that usesneural networks(many layers)
inspired by the human brain. Excellent with images, sound
and language.
Telling a cat from a dog in a photo
Generative AIAI built on DL that can createnew content: text, images,
code, audio.
ChatGPT, image-generation tools

1.3 Traditional Programming vs Machine Learning​

Understanding this difference is the most important thing, because all of ML stands on it.

  • Traditional Programming: You write the rules and provide the data , and the computer gives the answer .

  • Machine Learning: You provide the data and its answers , and the computer learns the rules by itself.

Example: Detecting Spam Email​

Traditional approach: You write rules: "if the email says 'lottery', it is spam". But spammers find new words and your rules fail.

ML approach: You give thousands of emails already labelled 'spam' or 'not spam'. The model learns by itself what spam patterns look like, and also works on new emails.

# Traditional programming: we write the rule ourselves
def is_spam(email_text):
if "lottery" in email_text.lower():
return True
return False
print(is_spam("You won a LOTTERY!")) # True
print(is_spam("Meeting at 5 pm")) # False

1.4 What is Data Science?​

Data Science is the field in which we collect data (information, numbers, text, images), clean it, find the patterns hidden in it, and draw decisions and predictions from it. Statistics, programming and an understanding of the domain (the field you are working in) all work together in it.

How Data Science, AI and ML Relate to Each Other​

  • The goal of Data Science : to extract insights from data. ML is one tool of it.

  • The goal of AI : to make machines smart. It needs data in order to learn.

  • All three are connected to each other, and there is a lot of overlap between them.

Types of Data​

TypeMeaningExample
Structured dataData arranged neatly in rows and columns (a table).Excel sheet, school results, bank
transactions
Unstructured dataData with no fixed arrangement.Pictures, videos, audio, emails, social media
posts
Semi-structured dataHas some arrangement but is not table-like.JSON files, XML, website data

Roles in Data Science​

RoleWorkAnalogy
Data AnalystLooks at existing data and makes reports and charts:
"what happened last month?"
The doctor who reads a report and tells
you how your health is right now
Data ScientistBuilds models to predict the future: "what will happen
next month?"
The doctor who tells you what illness
might come later
Data EngineerBuilds the whole system for collecting and delivering data
(pipelines, databases).
The plumber who lays the pipes for the
water (data)
ML EngineerRuns the model in a real application so that people can
use it.
The person who puts a new recipe on the
restaurant menu and gets it served every
day

1.5 Why Data Science? (Why we should learn it)​

1) Data is everywhere and grows every day​

Your phone, WhatsApp, YouTube, ATM, mobile wallet, online shopping: all of them are producing data every moment. If this data is not used properly, it just takes up space; if it is used properly, it improves decisions.

2) Decisions from data, not guesses​

Earlier, a shopkeeper would "guess" what would sell this Eid. Today, data shows which size, which colour and which area is buying the most.

3) Real-world examples​

FieldUse of Data Science
Banking / Mobile walletsFraud detection: instantly catching transactions that are out of the ordinary.
HealthcareEarly prediction of disease, analysis of X-ray and skin images, predicting patient rush at
hospitals.
Online shoppingRecommendation systems: showing items you like, predicting price and demand.
AgriculturePredicting crop yield from weather and soil data.
TransportBest traffic and route prediction, fares and driver matching in ride-hailing apps.
EducationSpotting weak students early by looking at student performance.
Weather and disastersWarning in advance using rain and flood patterns.

4) Career opportunities​

Companies all over the world are looking for people who can work with data. By learning Data Science you can become a Data Analyst, Data Scientist, ML Engineer or AI Developer, and freelancing opens up as well.

1.6 Data Science Pipeline​

A data science project is not built in one go. It is a series of steps called the Data Science Pipeline (or Data Science Lifecycle). The output of each step becomes the input of the next.

#StepWhat happensBiryani analogy
1Problem DefinitionDecide the question clearly: what do we want to solve?
What will the measure of success be?
What to cook, and for how many
guests?
2Data CollectionCollect data: files, databases, websites, APIs, surveys,
sensors.
Bringing ingredients from the
market
3Data Cleaning
(Preprocessing)
Fix empty (missing) values, duplicates and wrong entries.Washing and chopping the
vegetables
4EDA (Exploratory Data
Analysis)
Understand the data with charts and numbers; look for
patterns and strange things.
Tasting the spices
5Feature EngineeringChoose or create better columns (features) for the
model.
Getting the spice proportions
right
6Model BuildingTrain the ML algorithm on the data.Cooking in the pot
7Model EvaluationSee how accurate the model is; test it on new data.Letting the guests taste it
8DeploymentPut the model into an app or website so people can use
it.
Serving at the table
9Monitoring and
Maintenance
Keep checking that the model is not getting worse over
time; retrain when needed.
Getting feedback for the next
feast

This pipeline is not a straight line. You will often have to go back (for example, if the model turns out poor, you clean the data again). This is called an iterative process.

Example: House Price Prediction​

  1. Problem: Predict the price of a house from its size, number of rooms and area.

  2. Data collection: Collect old houses and their selling prices from property websites.

  3. Cleaning: Fix or remove houses whose price is missing or whose size is wrong.

  4. EDA: Use charts to see how the price rises as size increases.

  5. Feature engineering: Create a new column such as "price per square foot".

  6. Model: Train an algorithm such as Linear Regression.

  7. Evaluation: Check on new houses how far the prediction is from the real price.

  8. Deployment: Build a website where a user enters house details and sees the price.

  9. Monitoring: Update the model again when the market changes.

A Tiny Pipeline in Python (just look for now, you will understand it later)​

Below are the marks of three students. One student's mark is missing (None). See how the pipeline steps run:

# Step 2: Data collection (we have these marks)
marks = [78, 85, None, 92, 66]
# Step 3: Cleaning - remove the missing (None) values
clean_marks = []
for m in marks:
if m is not None:
clean_marks.append(m)
# Step 4: EDA - understand the data
print("Total students:", len(clean_marks))
print("Highest:", max(clean_marks))
print("Lowest:", min(clean_marks))
# Step 6/7: A tiny 'model' - compute the average
average = sum(clean_marks) / len(clean_marks)
print("Average:", average)

1.7 Tools and Setup: Google Colab​

We will use Google Colab to run Python. It is free, runs in the browser, and you do not need to install anything.

  1. Open colab.research.google.com in your browser and log in with your Google account.

  2. Click New notebook .

  3. You will get a code cell . Write your code in it.

  4. Press Shift + Enter or click the play button to run the cell.

  5. You can also create a text cell with + Text (for notes).

  6. Save the file to your Google Drive with File > Save .

print("Hello, Data Science!")

If you see Hello, Data Science! printed below, your setup is ready.

COMMON MISTAKES​
  • Treating AI, ML and DL as the same thing. Remember: AI is the biggest, ML is inside it, and DL is inside ML.

  • • Thinking Data Science is only coding. Statistics and understanding (domain knowledge) are just as important.

  • Jumping straight into building a model. First understand the problem and clean the data.

KEY TAKEAWAYS​
  • AI = making machines smart. ML = learning from data. DL = neural networks with many layers.

  • In traditional programming we write the rules; in ML the machine learns the rules from data.

  • Data Science = collecting data, cleaning it, and drawing insights and predictions from it.

  • Types of data: structured, unstructured, semi-structured.

  • Pipeline: Problem, Collection, Cleaning, EDA, Features, Model, Evaluation, Deployment, Monitoring.

  • Garbage In, Garbage Out: dirty data = wrong model.