AI: What Is AI?

AI (Artificial Intelligence) is no longer just a concept from science fiction movies—it has permeated everyday scenarios such as search engines, email filtering, autonomous driving, and code generation. This chapter will help you develop a comprehensive understanding of AI, including its essence, three key elements, and five major branches.

1. What You'll Learn



2. A True Story of a Backend Developer

(1) Pain Point: Confusion Surrounding a Company’s “AI Transformation”

Alice is a backend developer with five years of experience. Her company suddenly mandated that all projects be “AI-enabled.” She didn’t know where to start—what exactly was the connection between ChatGPT, machine learning, deep learning, and large language models? At a technical meeting, a colleague casually mentioned, “We use Transformers for recommendations,” and Alice could only pretend she understood.

(2) AI Solutions

Bob told her, "Don't worry. AI is simply a shift from 'you write the rules' to 'you provide data so the machine can learn the rules.' Let's first get a clear picture of the big picture—AI isn't a single, monolithic thing, but rather a general term for a set of technologies."

▶ Example: Overview of AI Technology Branches (Difficulty: ⭐)

TEXT
AI (Artificial Intelligence)
├── Machine Learning (ML)
│   ├── Supervised Learning
│   ├── Unsupervised Learning
│   └── Reinforcement Learning
├── Deep Learning (DL)
│   ├── CNN (Computer Vision)
│   ├── RNN / Transformer (NLP)
│   └── GAN / Diffusion (Generation)
├── Natural Language Processing (NLP)
├── Computer Vision (CV)
└── Robotics

(3) Benefits: From Confusion to Clarity

After completing this course, Alice realized that AI isn’t a mystery—it’s a structured tree. The recommendation system she’s working on falls under the “supervised learning → classification” branch, so she can achieve results without needing to understand computer vision.



3. What Is Artificial Intelligence?

Artificial intelligence (AI) is a technology that enables computers to understand, learn, reason, and make decisions. It no longer relies on fixed rules written by humans, but instead automatically discovers patterns in data.

(1) Traditional Programs vs. AI Programs

The key difference between traditional programs and AI programs lies in "who writes the rules":

Dimension Traditional Program AI Program
Input Data + Rules Data + Answers (Labels)
Processing Calculate according to rules Learn rules from data
Output Result Rule (Model) + Prediction
Modification Method Manually modify the code Retrain using new data
Analogy You write a recipe for a chef to follow You let the chef taste the dish and come up with the recipe on their own

▶ Example: Traditional Rules vs. AI-Based Spam Detection (Difficulty: ⭐⭐)

PYTHON
# Traditional approach: you write the rules
def is_spam_traditional(email):
    """Rule-based spam detection"""
    spam_keywords = ["free", "winner", "click here", "urgent"]
    for keyword in spam_keywords:
        if keyword in email.lower():
            return True
    return False

# AI approach: machine learns the rules from data
# from sklearn.naive_bayes import MultinomialNB
# model = MultinomialNB()
# model.fit(training_emails, training_labels)  # Machine learns rules
# prediction = model.predict(new_email)         # Machine applies learned rules

Output: (Run the example to see the actual output, or refer to the expected-output note in the code comments above.)

💡 Tip: The AI code above is presented as a comment because it requires training data. Starting in Lesson 4, we’ll actually run the sklearn code.

(2) The Formal Definition of AI

Different scholars have offered different definitions, but the core idea is the same—to enable machines to exhibit intelligent behavior:

Source Definition Keywords
Alan Turing (1950) If a machine's responses make it impossible to distinguish between the machine and a human, then the machine can be considered intelligent Turing Test
John McCarthy (1956) AI is the ability of machines to perform tasks that typically require human intelligence Intelligent behavior
Stuart Russell AI research on how to design agents that make rational decisions in their environments Rational Decision-Making


4. The Three Key Elements of AI: Data / Algorithms / Models

An AI system consists of three core elements, all of which are essential:

100%
graph TB
    A[Data] --> C[Model]
    B[Algorithm] --> C
    C --> D[Prediction / Decision]
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e9
    style D fill:#fff3e0

(1) Data — The Fuel for AI

Data is the raw material for AI learning. Without data, even the best algorithms are like a skilled cook without ingredients—they can’t do anything.

▶ Example: Load and examine a dataset (Difficulty: ⭐)

PYTHON
# Example: loading and inspecting a dataset
import pandas as pd

# Load a CSV dataset (e.g., house prices)
df = pd.DataFrame({
    'area_sqm': [50, 80, 120, 65, 200, 90],
    'rooms': [2, 3, 4, 2, 5, 3],
    'location_score': [7, 8, 6, 9, 5, 7],
    'price_usd': [150000, 280000, 350000, 220000, 500000, 260000]
})

print(df.describe())
💻 Output:

TEXT
        area_sqm    rooms  location_score     price_usd
count    6.000000  6.00000        6.000000  6.000000e+00
mean    84.166667  3.16667        7.000000  2.933333e+05
std     51.968585  1.16905        1.414214  1.196533e+05
min     50.000000  2.00000        5.000000  1.500000e+05
max    200.000000  5.00000        9.000000  5.000000e+05

Data Type Classification:

Data Type Description Example AI Processing Method
Structured data Has a fixed format (rows and columns) CSV, SQL tables Can be fed directly into ML models
Semi-structured data Partially structured JSON, XML, HTML Input after feature extraction
Unstructured Data No fixed format Images, audio, natural language Processed using deep learning

(2) Algorithm — How AI Learns

An algorithm is a mathematical method for extracting patterns from data. Different tasks require different algorithms:

Task Type Typical Algorithm What It Does
Category Decision Trees, SVM, KNN Classifying Data into Known Categories
Regression Linear Regression, Random Forests Predicting Continuous Values
Clustering K-Means, DBSCAN Automatically identifying groups in data
Generation GAN, Transformer Generate new data (text/images)

(3) Model — The Results of AI Learning

A model is the result of training an algorithm on data. Training is like "learning," and a model is like the "knowledge acquired."

▶ Example: Algorithm + Data → Model (Difficulty ⭐)

TEXT
Algorithm + Data → Training → Model

Example:
Linear Regression + House Price Data → Training → Price Prediction Model
(trained weights: price = 2500 * area + 15000 * rooms - 5000)

(4) An Analogy of the Three Elements

AI Elements Analogy Description
Data Ingredients Good ingredients (high-quality data) are the foundation of a good dish (a good model)
Algorithm Recipe Different recipes (algorithms) are suitable for different ingredients (data types)
Model Prepared dish The final product after training, ready to "eat" (prediction)


5. The Five Major Branches of AI

AI is not a single technology, but rather a disciplinary system comprising multiple subfields:

100%
mindmap
  root((AI))
    Machine Learning
      Supervised
      Unsupervised
      Reinforcement
    Deep Learning
      CNN
      RNN
      Transformer
    NLP
      Translation
      Sentiment
      Chat
    Computer Vision
      Classification
      Detection
      Generation
    Robotics
      Navigation
      Manipulation
Branch Core Mission Typical Applications Representative Technologies
Machine Learning (ML) Learning patterns from data Spam filtering, housing price prediction Decision trees, SVM, random forests
Deep Learning (DL) Learning with Multi-Layer Neural Networks Image Recognition, Speech Recognition CNN, RNN, Transformer
Natural Language Processing (NLP) Understanding and generating human language Translation, chatbots, summarization BERT, GPT, T5
Computer Vision (CV) Understanding and Generating Images/Videos Face Recognition, Autonomous Driving, AI Art YOLO, ResNet, Stable Diffusion
Robotics Intelligent Action in the Physical World Warehouse robots, surgical robots ROS, reinforcement learning
💡 Tip: These five branches are not isolated—autonomous driving simultaneously utilizes CV (vision), NLP (voice commands), and RL (decision-making and control). Modern AI applications typically involve the integration of multiple branches.



6. A Brief History of AI Development

Understanding the history of AI can help you grasp why today’s AI is so powerful (and why it might face another “winter”):

Period Event Significance
1950 Turing published "Computing Machinery and Intelligence" Raised the question, "Can machines think?"
1956 Dartmouth Conference; the term “AI” is coined AI becomes a distinct field of study
1960s–70s The Rise of Expert Systems Early Attempts to Put AI to Practical Use
1974–1980 The First AI Winter Unfulfilled promises, funding cut off
1980s Revival of expert systems + introduction of backpropagation Second wave of AI
1987–1993 The Second AI Winter Expert systems were too costly to maintain
2012 AlexNet Wins ImageNet (The Deep Learning Revolution) Demonstrates the Power of Deep Neural Networks + GPUs
2017 Google published "Attention Is All You Need" Transformer architecture introduced, NLP paradigm shift
2022 ChatGPT Launched Generative AI Goes Mainstream
2023–2026 GPT-4o, Claude, Llama, Qwen The Era of Multimodal + Open Source + Agents


7. Why Developers Must Understand AI

AI is reshaping every aspect of software development:

Dimension Risks of Not Understanding AI Benefits of Understanding AI
Employment Jobs requiring "CRUD skills" are being replaced by AI tools AI engineer is the fastest-growing job role
Product Product lacks smart features Quickly add smart features using an AI API
Efficiency Manual, repetitive work AI-assisted coding/testing/documentation
Competitiveness Outdated tech stack Mastering AI development = a technical advantage

▶ Example: Enhancing Apps with AI APIs (Difficulty: ⭐⭐)

PYTHON
# Example: Adding AI to your app is just a few lines of code
# (This requires an OpenAI API key, covered in Lesson 10)

# from openai import OpenAI
# client = OpenAI(api_key="your-api-key")
# 
# response = client.chat.completions.create(
#     model="gpt-4o-mini",
#     messages=[
#         {"role": "system", "content": "You are a helpful coding assistant."},
#         {"role": "user", "content": "Explain recursion in Python in 2 sentences."}
#     ]
# )
# print(response.choices[0].message.content)

Output: (Run the example to see the actual output, or refer to the expected-output note in the code comments above.)



8. Complete Example: Comparing Traditional Programs and AI Programs

Below is a complete Python example that compares the differences between "manually written rules" and "machine learning" for spam detection:

▶ Example: Comparing Traditional Programs and AI Programs for Spam Detection (Difficulty: ⭐⭐⭐)

PYTHON
# ============================================
# Compare: Rule-based vs Machine Learning
# Task: Spam email detection
# ============================================

# --- Approach 1: Traditional rule-based program ---
def is_spam_rules(email_text):
    """Detect spam using hand-written rules"""
    spam_words = ["free", "winner", "click", "urgent", "congratulations"]
    spam_count = sum(1 for word in spam_words if word in email_text.lower())
    return spam_count >= 2  # Arbitrary threshold

# --- Approach 2: Machine Learning (simulated) ---
# In real code, we would train a model on thousands of labeled emails.
# Here we simulate the trained model's behavior.
def is_spam_ml(email_text):
    """Detect spam using a trained ML model (simulated)"""
    # A real model learns patterns like:
    # - ALL CAPS subject lines → likely spam
    # - Multiple exclamation marks → likely spam
    # - Specific sender domains → likely spam
    # - Word combinations humans wouldn't think of
    learned_spam_score = 0.85  # Simulated confidence
    return learned_spam_score > 0.5

# --- Test both approaches ---
test_emails = [
    "Congratulations! You are our lucky winner! Click here to claim your FREE prize!",
    "Hey, can we reschedule tomorrow's meeting to 3 PM?",
    "URGENT: Your account will be closed! Click here immediately!",
]

print("=== Rule-based vs ML Spam Detection ===")
for email in test_emails:
    rule_result = is_spam_rules(email)
    ml_result = is_spam_ml(email)
    print(f"Email: {email[:60]}...")
    print(f"  Rule-based: {'Spam' if rule_result else 'Ham'}")
    print(f"  ML model:   {'Spam' if ml_result else 'Ham'}")
    print()
💻 Output:

TEXT
=== Rule-based vs ML Spam Detection ===
Email: Congratulations! You are our lucky winner! Click here to cl...
  Rule-based: Spam
  ML model:   Spam

Email: Hey, can we reschedule tomorrow's meeting to 3 PM?...
  Rule-based: Ham
  ML model:   Spam

Email: URGENT: Your account will be closed! Click here immediately!...
  Rule-based: Spam
  ML model:   Spam
⚠️ Note: The second email, titled "re-schedule meeting," was classified as normal by the rule-based system but as spam by the simulated ML model—this shows that ML can detect patterns that human rules overlook (though it may also produce false positives; this is precisely where AI ethics begins, and we’ll discuss this in depth in Lesson 15).


❓ FAQ

Q Is AI the same as ChatGPT?
A No. ChatGPT is just one application of AI (in the field of generative AI/NLP). AI also includes spam filtering (ML), facial recognition (CV), autonomous driving (CV+RL), and more. ChatGPT is currently the most popular AI product, but it does not represent the entirety of AI.
Q Do you need advanced math to study AI?
A Not at the beginner level. Understanding AI concepts and using APIs requires only basic math (averages, probability, and simple linear equations). You’ll need linear algebra, calculus, and probability theory only when designing algorithms in depth. This tutorial introduces mathematical concepts only when necessary and won’t start by deriving formulas right away.
Q Will AI replace programmers?
A Not in the short term. AI is more like a "programming assistant"—it helps you write code, debug, and look up documentation, but architectural design, understanding requirements, and making system trade-offs still require human input. Programmers who know how to use AI will see a significant boost in efficiency, but complete replacement is still a long way off. Rather than worrying about being replaced by AI, it’s better to learn how to use it.
Q What is the relationship between machine learning and deep learning?
A Deep learning is a subset of machine learning. ML encompasses all methods of "learning from data" (decision trees, SVMs, etc.), while DL specifically refers to methods that use multi-layer neural networks. The relationship is: AI ⊃ ML ⊃ DL.
Q Why is data often referred to as “the oil of AI”?
A Because the quality of AI depends on the quality of the training data. The larger the volume, the higher the quality, and the greater the diversity of the data, the stronger the model will be. Without good data, even the best algorithms cannot train a good model—just as without crude oil, even the best refinery cannot produce gasoline.
Q What is the relationship between AI and big data?
A Big data is the "fuel" (technologies for storing and processing massive amounts of data), while AI is the "engine" (technologies for extracting value from data). The two are complementary: big data provides training data for AI, and AI enables big data to generate practical value.

📖 Summary


📝 Exercises

  1. Basic Question (Difficulty: ⭐): List five AI applications from your daily life and identify which branch each belongs to (ML / DL / NLP / CV / Robotics).
  2. Advanced Problem (Difficulty ⭐⭐): Describe the differences between a traditional program and an AI program when determining whether an email is spam (specifying the input, processing, and output for each).
  3. Challenge (Difficulty: ⭐⭐⭐): Try out an AI product (such as ChatGPT, Midjourney, or GitHub Copilot) and write a 100-character analysis: Which branches of AI does it use? What challenges would you face if you tried to do the same thing with traditional programming?
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏