In the previous lesson we saw that artificial intelligence has seventy years of history and that its meaning has kept shifting: first it was "reasoning with symbols", then "capturing an expert's knowledge", later "learning from data" and today "generating text and images". With so much variety, it is easy for the term to be used loosely. In this lesson we will bring some order: we will see what AI is (and is not), how it relates to machine learning and deep learning, and we will draw a map of its major areas. That map matters because, when NovaMarket considers "using AI", it is really choosing between very different techniques, each suited to a particular kind of problem.
Contents
- What is artificial intelligence? Classic definitions
- The four views of Russell and Norvig
- AI versus automation and traditional programming
- AI, machine learning and deep learning: concentric circles
- Example in Python: hand-written rule versus learned rule
- Map of the areas of AI
- What NovaMarket would need from each area
- What is artificial intelligence? Classic definitions
There is no single definition accepted by everyone. Some of the most cited:
- John McCarthy (1956, 2007): "The science and engineering of making intelligent machines, especially intelligent computer programs." It is circular (what is "intelligent"?), but it sets the goal.
- Marvin Minsky (1968): "The science of making machines do things that would require intelligence if done by men." It puts the focus on the task, not the mechanism.
- Elaine Rich (1983): "The study of how to make computers do things at which, at the moment, people are better." Very honest: the boundary of "what counts as AI" moves over time.
- Nils Nilsson (2010): "The activity devoted to making machines intelligent, and intelligence is that quality that enables an entity to function appropriately and with foresight in its environment."
Two useful ideas follow from these definitions:
- AI is defined by what it achieves (behaviour) more than by how it does it.
- There is the so-called AI effect: as soon as a problem is solved, it stops being considered "artificial intelligence" and becomes "just software". Character recognition, the spell checker or GPS were AI in their day; nobody calls them that today.
- The four views of Russell and Norvig
The field's reference book, Artificial Intelligence: A Modern Approach by Stuart Russell and Peter Norvig, organises the historical definitions into a table with two axes: do we want the machine to think or to act? Do we want it to do so like a human or rationally (in the best possible way)?
| Like a human | Rationally | |
|---|---|---|
| Think | Thinking humanly: modelling human mental processes (cognitive science) | Thinking rationally: reasoning through formal logic (the "laws of thought") |
| Act | Acting humanly: behaving indistinguishably from a person (Turing test) | Acting rationally: doing the best possible given what is known (rational agent) |
Let us take them one by one:
- Acting humanly is the Turing-test view we saw in 01-01. It would require language processing, knowledge representation, reasoning, learning and (in its "total" version) vision and robotics. Its drawback: imitating humans includes imitating their mistakes, and that is not always what we want.
- Thinking humanly tries to reproduce how we actually think (through psychological experiments or neuroscience). It belongs more to cognitive science than to engineering.
- Thinking rationally inherits the logical tradition of Aristotle and Boole: if we formalise knowledge, a program can deduce correct conclusions. Its drawback: the real world is full of uncertainty and of knowledge that is hard to formalise.
- Acting rationally is the view adopted by Russell and Norvig and by most of the field today: a system is intelligent if it chooses actions that maximise its chances of achieving a goal given the available information. It does not need to think like us or to be logically perfect; it is enough that it does the best it can. This view gives rise to the concept of the rational agent, which we will study in lesson 02-01.
With that view, the working definition we will use in the course is:
Artificial intelligence is the discipline that builds systems capable of perceiving their environment, reasoning or learning from data and experience, and acting so as to achieve goals, in tasks that traditionally required human intelligence.
And for NovaMarket? A recommender system does not "think" like Marta when it suggests a product, nor does it imitate a human salesperson; it simply chooses, given a customer's history, the products most likely to interest them. It is AI in the sense of "acting rationally".
What AI is not
It is worth dispelling a few myths from the start:
- It is not a humanoid robot. Most AI systems are software without a body (a spam filter, a recommender).
- It is not magic or consciousness. Today's systems optimise specific objectives; they do not "want" anything nor understand in the human sense. The different levels of capability (narrow AI, strong AI, etc.) are covered in lesson 02-02.
- It is not a single technology. It is an umbrella covering very different techniques; some learn from data, others reason with rules, others search for solutions in a space of possibilities.
- It is not a synonym for "complex program". An ERP with thousands of lines of code is not AI; a 20-line regression that learns from data can be.
- AI versus automation and traditional programming
A frequent confusion in companies is calling any automation "AI". Diego, at NovaMarket, has a script that every night flags as "delayed" any order that has gone more than 5 days without being delivered. Is it AI? No: it is a fixed rule written by a person. The difference lies in where the logic comes from and in how it behaves in new situations.
| Aspect | Traditional programming / automation | Artificial intelligence |
|---|---|---|
| Origin of the logic | Written explicitly by the programmer | Derived from data, examples or a search/reasoning process |
| Inputs | Structured and anticipated in advance | May be unstructured (text, images, speech) or unforeseen situations |
| Behaviour on new cases | Fails or ignores whatever is not covered | Generalises (more or less accurately) |
| Output | Deterministic: same input, same output | Often probabilistic: "85% probability of fraud" |
| Maintenance | Change the code by hand | Retrain with new data, adjust objectives |
| Explainability | High: you can read the code | Variable: from readable rules to "black boxes" |
| NovaMarket example | "If the order exceeds €50, free shipping" | "Predict how many units of product X will sell next week" |
The classic way of putting it, popularised by Andrew Ng and others, is this:
flowchart LR
subgraph T[Traditional programming]
A1[Data] --> P1[Hand-written program] --> R1[Results]
end
subgraph M[Machine learning]
A2[Data] --> P2[Learning algorithm]
R2[Known results] --> P2
P2 --> P3[Learned program = model]
end
In traditional programming we feed in data and a program and get results. In machine learning we feed in data and known results (examples), and the algorithm produces the program (the model), which we then use on new data. Note: machine learning is only one part of AI, as we will see next, but it is the part that has grown the most.
An important nuance: not all AI learns from data. A route planner that finds the shortest path by search, or an expert system that applies warranty rules, are AI without machine learning. And not all automation is AI, however much many marketing departments would like it to look that way.
- AI, machine learning and deep learning: concentric circles
Three terms that are used as synonyms and are not:
- Artificial intelligence (AI): the whole field. It includes search, planning, logic, expert systems, robotics, learning, and so on.
- Machine learning (ML): the subset of AI in which the system improves its performance from data, rather than being explicitly programmed. It ranges from linear regression to decision trees.
- Deep learning (DL): the subset of ML that uses neural networks with many layers. It is responsible for the great advances since 2012 (vision, speech, language, generation).
flowchart TB
subgraph IA[Artificial Intelligence]
direction TB
S[Search and planning]
L[Logic and expert systems]
R[Robotics]
subgraph ML[Machine Learning]
direction TB
C[Regression, trees, k-nearest neighbours...]
subgraph DL[Deep Learning]
N[Deep neural networks]
G[Transformers / generative AI]
end
end
end
Some practical consequences of this scheme:
| Statement | Correct? | Why |
|---|---|---|
| "All deep learning is machine learning" | Yes | DL ⊂ ML |
| "All machine learning is AI" | Yes | ML ⊂ AI |
| "All AI is machine learning" | No | A* search, minimax or an expert system do not learn from data |
| "Generative AI is deep learning" | Yes (in current practice) | Modern generative models are deep networks, almost always transformers or diffusion models |
| "A rule-based chatbot is deep learning" | No | It is symbolic AI (rules), like ELIZA |
At NovaMarket, this scheme helps Marta speak precisely: demand forecasting will probably be classical ML; review classification could be done with classical ML or with deep learning; delivery routes are search (AI without learning); return rules are an expert system.
- Example in Python: hand-written rule versus learned rule
Let us make the difference between "programming the logic" and "learning the logic" tangible with a tiny example and no libraries. Situation: NovaMarket wants to flag orders at risk of return so that Diego can review them before shipping. We have a handful of historical orders from orders.csv, with the amount and whether they were eventually returned or not.
5.1 The hand-written rule
Diego, from experience, believes that expensive orders get returned more. He writes:
def manual_risk(amount):
"""Rule hand-written by Diego: fixed threshold at 300 euros."""
return amount > 300 # True = risk of returnSimple, readable... and based on a hunch. Is 300 the right threshold? Nobody knows.
5.2 The rule learned from data
Marta proposes something else: let the data choose the threshold. The simplest possible way to "learn" is to try many thresholds and keep the one that best separates returned orders from non-returned ones in the historical data.
# Historical data: (amount in euros, was_returned)
history = [
(25, False), (40, False), (60, False), (95, False), (120, False),
(150, True), (180, True), (210, True), (260, True), (320, True),
(450, True), (80, True), (500, False),
]
def hits(threshold, data):
"""Counts how many orders the rule 'amount > threshold' classifies correctly."""
correct = 0
for amount, was_returned in data:
prediction = amount > threshold
if prediction == was_returned:
correct += 1
return correct
def learn_threshold(data):
"""Tries every amount as a candidate threshold and returns the best one."""
best_threshold = None
best_hits = -1
for amount, _ in data: # each amount is a candidate threshold
n = hits(amount, data)
if n > best_hits:
best_hits = n
best_threshold = amount
return best_threshold, best_hits
threshold, n = learn_threshold(history)
print("Learned threshold:", threshold, "-> gets", n, "of", len(history), "right")
print("Diego's threshold (300) -> gets", hits(300, history), "of", len(history), "right")
def learned_risk(amount):
return amount > threshold
print(learned_risk(200)) # is a 200-euro order at risk?Output:
Step by step:
historyis our training data: examples with the correct answer known (Trueif the order was returned).hits(threshold, data)measures how well a specific rule works: it walks through the examples, applies the ruleamount > thresholdand counts how many times it matches reality. This is, in miniature, an evaluation metric.learn_threshold(data)is our learning algorithm: it tries every amount that appears in the data as a threshold and keeps the one that scores the most hits. There is no hunch here: the data choose the threshold.learned_riskis the resulting model: it has the same shape as Diego's rule (amount > something), but the "something" has been learned.
Observations:
- With this history, the learned threshold (€120) gets 11 of 13 right, and Diego's gets 7 of 13. The data have corrected the hunch.
- There are two examples that no threshold rule would classify correctly: an €80 order that was returned and a €500 one that was not. It is a hint that the amount alone is not enough: we would need to add more information (product category, new or regular customer...). Choosing those variables is the "feature preparation" of module 4.
- If more orders arrive tomorrow, we simply retrain (run
learn_thresholdagain) instead of persuading Diego to change 300 to another number. - With 13 examples the threshold is not very reliable; with thousands it would be a different story. How to know whether a model is reliable is covered in lesson 04-05.
This example is machine learning in its most rudimentary form (a "decision tree" with a single question). Everything we will see in modules 4 and 5 is a more sophisticated version of the same idea: define a family of possible rules, measure how well they work and search for the best one.
- Map of the areas of AI
AI is organised into areas that overlap but have their own problems, techniques and communities. Here we present the eight most relevant; some are developed in later modules and here we only place them on the map.
6.1 Machine learning
- What it solves: finding patterns in data to predict (how much will we sell?), classify (is this fraud?), cluster (what kinds of customers do we have?) or recommend.
- Everyday example: your email spam filter, which learns from the messages you flag.
- Studied in: module 4 (and its deep version, module 5).
6.2 Natural language processing (NLP)
- What it solves: getting machines to work with human text and speech: understanding, classifying, translating, summarising, answering, generating.
- Everyday example: the translator on your phone, keyboard autocomplete, a voice assistant.
- Studied in: lessons 05-04 and 05-05 (today NLP is based mostly on deep learning and transformers).
6.3 Computer vision
- What it solves: interpreting images and video: recognising objects, faces, text, defects; segmenting; estimating motion.
- Everyday example: unlocking your phone with your face; the camera that reads number plates in a car park.
- Studied in: lesson 05-04.
6.4 Robotics
- What it solves: getting physical machines to perceive their environment and act in it (moving, handling objects), integrating sensors, control and planning.
- Everyday example: a robot vacuum that maps the house; the robotic arms in a car factory.
- Studied in: transversally (it uses search, vision and learning).
6.5 Expert systems and knowledge representation
- What it solves: capturing experts' knowledge in the form of rules, facts and relationships (ontologies) in order to reason over them and explain the conclusions.
- Everyday example: a bank's assistant that decides whether to grant a card by applying the regulations; medical diagnosis support systems.
- Studied in: module 6.
6.6 Search and planning
- What it solves: finding a sequence of actions (or a configuration) that leads from an initial situation to a goal, often minimising a cost: routes, timetables, assignments, game moves.
- Everyday example: the GPS navigator that computes the fastest route; computer chess.
- Studied in: module 3.
6.7 Intelligent agents
- What it solves: organising a system as an entity that perceives, decides and acts autonomously in an environment, possibly collaborating with other agents.
- Everyday example: a smart thermostat that learns your schedule; the non-player characters in a video game; software agents that carry out tasks for you.
- Studied in: lesson 02-01 (here we only place it on the map).
6.8 Generative AI
- What it solves: creating new content (text, images, audio, code, video) from instructions, by learning the distribution of large collections of examples.
- Everyday example: a conversational assistant that drafts an email; a tool that generates an image from a description.
- Studied in: lesson 05-05.
Summary table
| Area | Typical question | Input | Output | Main technique today |
|---|---|---|---|---|
| Machine learning | What will happen / which class does it belong to? | Data tables | Prediction, class, cluster | Statistical models, trees, networks |
| NLP | What does this text say? | Text, speech | Class, summary, translation, answer | Transformers |
| Vision | What is in this image? | Pixels | Labels, boxes, segments | Convolutional networks, transformers |
| Robotics | How do I move and act? | Sensors | Movements | Control + search + learning |
| Expert systems | What do the regulations/the expert conclude? | Facts | Diagnosis, explained decision | Rules, logic, ontologies |
| Search and planning | Which path/plan is best? | Initial state, goal | Sequence of actions | A*, minimax, heuristics, optimisation |
| Agents | What do I do now? | Percepts | Actions | Agent architectures, reinforcement |
| Generative AI | Create X from Y | Instruction (prompt) | Text, image, code | Transformers, diffusion |
- What NovaMarket would need from each area
Let us bring the map down to earth. For each area, which NovaMarket problem would it solve and what would be needed to tackle it? (In the next lesson, 01-03, we will turn this into a plan of use cases; here we only connect areas with needs.)
| Area | NovaMarket problem | What it would need |
|---|---|---|
| Machine learning | Forecast weekly demand per product; detect fraudulent orders or orders with a high probability of return | Clean history from orders.csv and products.csv; a definition of what counts as "fraud" or "return" for labelling |
| NLP | Automatically classify reviews.csv (positive/negative, topic: shipping, quality, price); understand customer queries |
Labelled reviews for training or a pre-trained model; examples of real conversations |
| Vision | Detect damaged products from the photos customers send with incidents; read labels in the warehouse | Enough photos of damaged and undamaged products; cameras in the warehouse |
| Robotics | In the medium term, picking robots in the Zaragoza and Getafe warehouses | Investment in hardware; not a priority today |
| Expert systems | Automate the rules for returns and warranties; guided diagnosis of order incidents | Diego and the legal team formalising the rules in writing; incidents.csv for validation |
| Search and planning | Plan delivery routes in the city; assign orders to delivery drivers and warehouses | The city graph (streets, times), capacity constraints and time windows |
| Agents | A customer-service assistant that looks up the order status and acts (reship, process a return) | Integration with internal systems; clear policies on what it may do on its own |
| Generative AI | Write product descriptions, summarise reviews, reply in natural language | Access to a language model; human review; care with personal data |
Notice one thing: a single business need can touch several areas. The "customer-service assistant" combines NLP (understanding the question), generative AI (drafting the reply), an agent (deciding which action to take) and perhaps an expert system (applying the returns policy). That is why the map is an analysis tool, not a set of watertight compartments.
Common Mistakes and Tips
- Calling any automation AI. An
ifis not AI. Ask yourself: was the logic written by a person or was it obtained from data/search/reasoning? How does it behave on unforeseen cases? - Using AI, machine learning and deep learning as synonyms. They are concentric circles: DL ⊂ ML ⊂ AI. Saying "we are going to do deep learning" when you have 200 rows in a table is usually a mistake; saying "this is not AI because it does not use neural networks" is one too.
- Believing machine learning is needed for everything. NovaMarket's delivery routes or warranty rules are better solved with search and rules than with a trained model. Choosing the right area is half the job.
- Trusting a "learned rule" built on little data. In the example, 13 orders are enough to illustrate the idea, not to make decisions. The quantity and quality of data matter (lesson 02-03).
- Tip: when someone proposes "using AI" for something, mentally translate it into a row of the areas table: which question does it answer, with what input, what output and with which technique? If you cannot fill in the row, the problem is not yet well defined.
Exercises
Exercise 1: AI or not AI?
For each system, say whether you would consider it AI (and which area it would fit in) or traditional programming, justifying your answer in one sentence:
a) A program that sends an automatic email when an order changes to "shipped". b) A program that, from a customer's photos, decides whether the parcel arrived damaged. c) A program that computes the VAT on each order line. d) A program that orders a delivery driver's stops to minimise kilometres. e) A program that applies the written returns policy (deadlines, condition of the product) and explains why it accepts or rejects. f) A program that suggests "other customers also bought..." from purchase history.
Exercise 2: Concentric circles
Place on the AI / ML / DL diagram: (1) minimax for playing draughts; (2) a model that predicts the price of a house with a straight line fitted to the data; (3) a transformer that translates reviews from Catalan into Spanish; (4) an insurance company's rules engine; (5) a 30-layer neural network that recognises products in photos.
Exercise 3: Improving the learned rule
In the example in section 5, the model can only learn rules of the form amount > threshold. Extend the code so that it also tries rules of the form amount < threshold and picks the best of all (indicating the direction). Run it with the same data and check whether the result changes. Then replace the history with this other one and observe what happens:
history2 = [(20, True), (35, True), (50, True), (90, False), (150, False), (300, False), (30, False)]Solutions
Solution 1
| System | AI? | Area / justification |
|---|---|---|
| a) Email on status change | No | Fixed hand-written rule; classic automation |
| b) Detecting damage in photos | Yes | Computer vision; the logic is learned from examples, unstructured input |
| c) Computing VAT | No | Deterministic formula, with no uncertainty or learning |
| d) Ordering the driver's stops | Yes | Search and planning (route optimisation), although it does not learn from data |
| e) Applying the returns policy with explanation | Yes (borderline) | Expert system: rules written by humans but with a reasoning and explanation engine; many would consider it classic symbolic AI |
| f) "Other customers also bought" | Yes | Machine learning (recommendation): the patterns come from the data |
Note on (e): it is the most debatable case. A single if is not AI; an engine that chains dozens of rules, resolves conflicts and explains its conclusions is what has historically been called an expert system. The boundary is blurry, and that too is a lesson.
Solution 2
- (1) Minimax: AI, but not ML (adversarial search).
- (2) Straight line fitted to data (linear regression): ML, but not DL.
- (3) Translating transformer: DL (and therefore ML and AI).
- (4) Insurance rules engine: symbolic AI, not ML (expert system).
- (5) 30-layer network: DL.
Solution 3
def hits_dir(threshold, direction, data):
correct = 0
for amount, was_returned in data:
if direction == ">":
prediction = amount > threshold
else:
prediction = amount < threshold
if prediction == was_returned:
correct += 1
return correct
def learn_rule(data):
best = (None, None, -1) # (threshold, direction, hits)
for amount, _ in data:
for direction in (">", "<"):
n = hits_dir(amount, direction, data)
if n > best[2]:
best = (amount, direction, n)
return best
print(learn_rule(history)) # -> (120, '>', 11)
print(learn_rule(history2)) # -> (90, '<', 6)With the original history, the best rule is still amount > 120 (11 hits): adding the < direction does not help because it is the expensive orders that get returned. With history2 the situation is reversed: it is the cheap orders that get returned, and the algorithm discovers this on its own, learning amount < 90 with 6 hits out of 7. That is the key point of the lesson: the same piece of code learns different rules depending on the data, without anyone having to rewrite the logic. Diego, with his manual rule, would have needed to notice the change and modify the code.
Conclusion
In this lesson we have given a working definition of artificial intelligence (systems that perceive, reason or learn, and act to achieve goals), we have placed the four views of Russell and Norvig and adopted that of "acting rationally", we have distinguished AI from traditional automation (the logic is learned or searched for rather than written) and we have clarified that deep learning is a subset of machine learning, which in turn is a subset of AI. With a minimal Python example we have seen the difference between a hand-written rule and a rule learned from data, and we have drawn a map of eight areas (machine learning, NLP, vision, robotics, expert systems, search and planning, agents and generative AI), connecting each with NovaMarket's needs.
We now have the vocabulary and the map. In the next lesson, Real-Life Applications of AI, we will go sector by sector through how these areas are used today (health, transport, finance, retail, industry...) and, above all, we will fix the list of candidate use cases for NovaMarket that will guide the rest of the course.
Fundamentals of Artificial Intelligence (AI)
Module 1: Introduction to Artificial Intelligence
Module 2: Basic Principles of AI
- Fundamental Concepts: Agents, Environments and Rationality
- Types of Artificial Intelligence
- Data as the Raw Material of AI
- Ethics and Considerations in AI
Module 3: Algorithms in AI
- Introduction to Algorithms
- Search Algorithms
- Adversarial Search: Games and Minimax
- Optimization Algorithms
Module 4: Machine Learning
- Basic Concepts of Machine Learning
- Types of Machine Learning
- Data Preparation and Feature Engineering
- Machine Learning Algorithms
- Model Evaluation and Validation
- Overfitting, Regularization and Hyperparameter Tuning
Module 5: Neural Networks and Deep Learning
- Introduction to Neural Networks
- Neural Network Architecture
- How a Network Learns: Gradient Descent and Backpropagation
- Deep Learning and Its Applications
- Transformers, Large Language Models and Generative AI
Module 6: Logic and Expert Systems
- Logic in AI
- Expert Systems
- Reasoning under Uncertainty: Probability and Bayesian Networks
- Applications of Expert Systems
Module 7: Tools and Programming Languages in AI
- Programming Languages for AI
- Scientific Python: NumPy, pandas and Matplotlib
- Popular Tools and Libraries
- Development Environments
Module 8: Projects and Case Studies
Module 9: Exercises and Practice
- Algorithm Exercises
- Machine Learning Practice
- Neural Network Projects
- Capstone Project: from Idea to Prototype
