AI FoundationsBeginner9 min01 / 14

What is Artificial Intelligence?

Discover what AI really means, how it differs from plain programming, and where Machine Learning and Deep Learning fit in.

Your phone unlocks when it sees your face. A spam filter quietly moves junk mail out of your inbox. A navigation app reroutes you around traffic in real time. None of these were programmed with an exhaustive list of rules — instead, they learned from examples, adapted, and made decisions on their own. That's Artificial Intelligence at work.

Artificial Intelligence is a broad term for getting computers to do things that normally require human-level thinking: recognising objects, understanding language, making decisions, and learning from experience.

Think of it like

The Recipe vs. the Chef

Traditional programming is like handing someone a recipe: follow these exact steps in this exact order. AI is more like training a chef: show them thousands of dishes, let them experiment, and eventually they develop intuition — they can improvise a new dish even if they've never seen that exact combination of ingredients before.

#Two Big Approaches to AI

Researchers have tried two very different strategies:

  • Symbolic / Rule-based AI — Experts write explicit rules: if email contains "win a prize" then mark as spam. Works well in narrow, well-defined domains but breaks down when the real world is messy and full of exceptions.
  • Learning-from-data AI — Feed the system thousands of labelled examples and let it discover the patterns itself. This is Machine Learning, and it powers almost everything exciting in AI today.

The code below shows why rule-based systems are fragile:

Change one letter and the rule-based filter is fooled. A learning system would catch the pattern.
def is_spam_rules(email):
    bad = ["win a prize", "click here now", "free money"]
    return any(phrase in email.lower() for phrase in bad)

print(is_spam_rules("You've won a prize!"))   # True
print(is_spam_rules("Meeting at 3pm today"))  # False
print(is_spam_rules("Y0u've w0n a pr1ze!"))   # False -- oops!

#AI, Machine Learning, and Deep Learning — How They Nest

These three terms get mixed up constantly. Think of them as nested circles:

  • AI — the broadest goal: making machines act intelligently.
  • Machine Learning (ML) — a specific method inside AI: algorithms that improve by learning from data, without being explicitly told the rules.
  • Deep Learning (DL) — a specific kind of ML using large neural networks with many layers ("deep" refers to those layers).

All Deep Learning is ML. All ML is AI. But not all AI is ML, and not all ML is Deep Learning.

#Narrow AI vs. General AI — and How Learning Works

Every AI system that exists today is Narrow AI — extremely good at one specific task, helpless outside it. The image classifier that beats doctors at spotting tumours cannot play chess. General AI (AGI) — a machine that reasons across any domain like a human — does not yet exist.

Narrow AI routinely outperforms humans within its specialty (AlphaFold cracked a 50-year biology puzzle), but it works by finding statistical patterns, not true understanding. A learning algorithm does this in three steps: 1. Look at labelled examples — input → correct answer pairs. 2. Predict, then measure the error — how wrong was the guess? 3. Adjust internal "weights" to reduce the error — repeat thousands of times.

The snippet below learns the Celsius-to-Fahrenheit formula purely from data — no formula given:

Four data points, 5000 tiny adjustments, and it figured out the formula by itself.
data = [(0, 32), (100, 212), (25, 77), (37, 98.6)]
weight, bias = 1.0, 0.0   # bad initial guesses
lr = 0.0001               # adjustment step size

for _ in range(5000):
    for c, f in data:
        err = (weight * c + bias) - f
        weight -= lr * err * c
        bias   -= lr * err

print(f"Learned weight: {weight:.4f}  (true: 1.8)")
print(f"Learned bias:   {bias:.4f}  (true: 32.0)")
print(f"Predict 100C -> {weight*100+bias:.1f}F")
Common mistake

AI Is Not Magic — and Not Always Right

A common misconception is that AI "understands" things the way humans do. It doesn't. It finds statistical patterns in training data. If the data is biased, the AI will be biased. If you ask it something far outside what it was trained on, it can fail badly — and often confidently. AI is a powerful tool, not an oracle.

Quick check

A company builds an AI that diagnoses skin cancer from photos with 95% accuracy, but it cannot answer any other kind of question. Which term best describes this system?

AI is already woven into your daily life: spam filters, recommendation engines, voice assistants, navigation apps, face unlock, autocomplete. Each uses a different flavour of AI, all narrowly specialised for one job. In the lessons ahead you'll zoom in on the details — how models actually train, what a neural network really looks like inside, and how to stop a model from just memorising instead of truly learning.

Key takeaways

  • AI means getting computers to handle tasks that normally need human-level reasoning — perceiving, deciding, and learning.
  • Narrow AI (today's reality) is brilliant at one specific job but helpless outside it; General AI (human-level flexibility) does not yet exist.
  • AI, Machine Learning, and Deep Learning are nested circles — DL is a subset of ML, which is a subset of AI. They are not synonyms.
  • The rule-based approach writes logic by hand; the learning-from-data approach lets algorithms discover patterns in examples automatically.
  • AI finds statistical patterns — it does not truly 'understand', and biased or out-of-distribution data can make it fail badly.
Practice challenges
Test yourself · earn XP
0/4
Predict the output#1

This is the rule-based spam filter from the lesson. What does it print?

predict-output
def is_spam_rules(email):
    bad = ["win a prize", "click here now", "free money"]
    return any(phrase in email.lower() for phrase in bad)

print(is_spam_rules("Win a prize now!"))
print(is_spam_rules("W1n a pr1ze now!"))
Fill in the blank#2

Complete this Narrow-AI classifier so an unknown animal safely defaults to False instead of raising an error.

def can_fly_rules(animal):
    known = {"eagle": True, "dog": False}
    return known.(animal.lower(), False)

print(can_fly_rules("unicorn"))  # False
Reorder the lines#3

Put the lesson's three-step learning loop in order: the body of the training loop that learns Celsius-to-Fahrenheit from data.

1
    for c, f in data:
2
        bias -= lr * err
3
        weight -= lr * err * c
4
        err = (weight * c + bias) - f
5
for _ in range(5000):
Fix the bug#4

This code is meant to update the model's weight to reduce its error, but it makes the model worse each step. What's wrong?

fix-bug
err = (weight * c + bias) - f   # positive means we guessed too high
weight += lr * err * c          # nudge the weight
bias   += lr * err
Your turn
Practice exercise

Write two classifier functions. First, can_fly_rules(animal): a rule-based classifier that returns True or False by looking up the animal name in a dictionary you define. Second, simple_ml_classify(features): a feature-based classifier that takes a list [has_wings, is_light] (each 0 or 1) and returns True only when all features are 1. Test both on at least two animals and two feature lists.

Try it live — edit the code and hit Run to execute real Python:

solution.py · editable