Lesson 46
Econometrics and Machine Learning: Different Questions, Shared Tools
Big question
Which tasks deserve the label AI, and which claims collapse when we ask what data, objective, and evaluation produced the result?
Lesson progress
Complete checkpoints as you learn
Learning objectives
- Distinguish AI, machine learning, deep learning, and generative AI.
- Separate rule-based systems from learned models.
- Explain regression, classification, generation, and retrieval.
- Identify hallucination, bias, privacy, and deepfake risks.
- Prerequisites: Parts I and II.
- Key terms: artificial intelligence, machine learning, deep learning, generative AI, hallucination, bias.
Simple explanation
Artificial intelligence is a broad label for systems designed to perform tasks associated with perception, language, prediction, planning, or decision support. Machine learning is a subset in which patterns are estimated from data rather than fully specified as hand-written rules. Deep learning uses layered neural networks. Generative models produce new text, images, audio, or code. A system can be useful and still be narrow: performance on one task does not imply general understanding.
Key terms
- AI, machine learning, deep learning, and generative AI
- A core idea in Chapter 46 that students apply carefully in economic analysis.
- Separate rule-based systems from learned models
- A core idea in Chapter 46 that students apply carefully in economic analysis.
- regression, classification, generation, and retrieval
- A core idea in Chapter 46 that students apply carefully in economic analysis.
- Identify hallucination, bias, privacy, and deepfake risks
- A core idea in Chapter 46 that students apply carefully in economic analysis.
- Prerequisites: Parts I and II
- A core idea in Chapter 46 that students apply carefully in economic analysis.
- Key terms: artificial intelligence, machine learning, deep learning, generative AI, hallucination, bias
- A core idea in Chapter 46 that students apply carefully in economic analysis.
Analytical workflow
Interpret the expression in words and units before using it in a claim.
Example
Interpretation. The threshold is fully specified by a person. A learned classifier would estimate a boundary from labelled examples.
Prerequisites
- Complete the preceding course chapters or review their summaries as needed.
Full theory and examples
46.2
AI is an umbrella, not a single mechanism
Artificial intelligence is a broad label for systems designed to perform tasks associated with perception, language, prediction, planning, or decision support. Machine learning is a subset in which patterns are estimated from data rather than fully specified as hand-written rules. Deep learning uses layered neural networks. Generative models produce new text, images, audio, or code. A system can be useful and still be narrow: performance on one task does not imply general understanding.
46.3
Learning means optimizing an objective
A supervised model receives examples with features and targets and chooses parameters that reduce a loss function. A classifier does not “know” a class in the human sense; it maps inputs to scores or probabilities according to its training objective. Unsupervised methods search for structure without labelled outcomes. Reinforcement learning connects actions to rewards. Every approach inherits the information and omissions in its data and objective.
46.4
Fluency is not verification
Generative systems can produce coherent but unsupported statements, fabricated references, or subtly incorrect code. Hallucination is not cured by confident prose. Bias can enter through historical data, labels, sampling, model choices, or deployment context. Deepfakes and synthetic media make provenance checks increasingly important. Responsible use requires disclosure, privacy protection, human review, and task-specific evaluation rather than vague trust in “AI” (Sharifi-Zarchi and contributors 2026).
46.5
Python demonstrations
46.5.1
Demonstration 27.1: Rules versus learned boundaries
Verified output
Interpretation. The threshold is fully specified by a person. A learned classifier would estimate a boundary from labelled examples.
46.5.2
Demonstration 27.2: A tiny learned classifier
Verified output
Interpretation. The probabilities arise from the fitted data and model, not from a hand-coded threshold, although the training labels still reflect human choices.
46.6
Visual evidence
46.7
Reference table
Why This Matters
Clear definitions prevent AI enthusiasm from outrunning evidence, governance, and task-specific evaluation.
Common Mistake
Treating a fluent language-model answer as a cited fact or a successful code run as proof of conceptual correctness.
Ceteris LAB Tip
Ask four questions: What is the task? What data shaped the system? What objective was optimized? How was performance evaluated?
R-to-Python / Source Bridge
This chapter adapts the first three IntroAI sessions, which emphasize practical intuition, inflated claims, hallucination, bias, and the difference between programming rules and learning patterns (Sharifi-Zarchi and contributors 2026).
| System type | Learns from examples? | Typical output |
|---|---|---|
| rule-based program | No, rules are coded | deterministic decision |
| regression model | Yes | continuous prediction |
| classifier | Yes | class score or probability |
| generative model | Yes | new content |
| retrieval system | Indexes examples/documents | ranked evidence |
| agent | May combine models and tools | multi-step action |
Visual evidence

Additional Python demonstrations
Live Python
Source demonstration 2
Source demonstration 2
Stdout
Run Python to see results here.
Status / stderr
Ready to run Python in your browser.
Line-by-line guide
- Line 1Load a Python library needed for data work or regression.
- Line 2Load a Python library needed for data work or regression.
- Line 4Create or update a Python object used in the analysis.
- Line 5Create or update a Python object used in the analysis.
- Line 6Create or update a Python object used in the analysis.
- Line 7Display a result so students can inspect the output.
Verified source output
55000 not high 72000 high
[[0.76 0.24] [0. 1. ]]
55000 not high 72000 high
[[0.76 0.24] [0. 1. ]]
def rule_based_income(income): print(value, rule_based_income(value)) import numpy as np from sklearn.linear_model import LogisticRegression X = np.array([[20], [30], [45], [60], [75], [90]]) y = np.array([0, 0, 0, 1, 1, 1])
Interpretation. The threshold is fully specified by a person. A learned classifier would estimate a boundary from labelled examples.
Interpretation. The probabilities arise from the fitted data and model, not from a hand-coded threshold, although the training labels still reflect human choices.
Guided practice
- 1Re-run Demonstration 27.1 and change one input while keeping the analytical question fixed.
- 2Explain in two sentences how the output supports, or fails to support, the chapter opening question.
- 3Add one validation check that would prevent a plausible error.
Exercises
- 1Classify five everyday systems as rule-based, predictive, generative, retrieval, or agentic.
- 2Give one example of label bias.
- 3Design a verification checklist for AI-generated code.
- 4Explain why narrow task performance is not evidence of general intelligence.
Source and downloads
Chapter 46 of Fundamentals of Python for Financial Econometrics by Mohammad Safavi, Ph.D.. The lesson is an original Ceteris Lab web adaptation of the supplied publication package.
Live Python
Econometrics and Machine Learning: Different Questions, Shared Tools: live Python
Econometrics and Machine Learning: Different Questions, Shared Tools: live Python
Stdout
Run Python to see results here.
Status / stderr
Ready to run Python in your browser.
Line-by-line guide
- Line 1Run this Python instruction as part of the lesson workflow.
- Line 2Create or update a Python object used in the analysis.
- Line 4Run this Python instruction as part of the lesson workflow.
- Line 5Display a result so students can inspect the output.
Python walkthrough
- 1`def rule_based_income(income):`: Defines a reusable function with an explicit analytical purpose.
- 2`return "high" if income >= 70_000 else "not high"`: Creates or updates a named object used by later steps.
- 3`for value in [55_000, 72_000]:`: Repeats the indented calculation across observations or simulation draws.
- 4`print(value, rule_based_income(value))`: Displays a result so it can be checked and interpreted.
Live notebook
Run this lesson as a notebook
Open an editable notebook cell-by-cell, run Python in the browser, and download the `.ipynb` file for later.
Related dataset
Ceteris Lab teaching sample
Estimated time
25 to 40 min
Packages
pandas, numpy, statsmodels, patsy
Expected output
A regression or inference table with coefficients, uncertainty, and short interpretation notes.
Learning goals
- Load and inspect Ceteris Lab teaching sample.
- Run the Python cells connected to Econometrics and Machine Learning: Different Questions, Shared Tools.
- Interpret the output using AI, machine learning, deep learning, and generative AI and Separate rule-based systems from learned models.
Common errors
- File not found: check that wage_sample.csv is installed or use the course data folder.
- Package import error: use the browser notebook first, then download for local Jupyter if your local packages differ.
- Column name error: compare your variable names with the dataset variables listed for this notebook.
Dataset path helper
import pandas as pd
df = pd.read_csv("/data/wage_sample.csv")
df.head()Interactive activity
Chapter 46 interactive
Model governance check
What is the safest basis for evaluating an ML or AI result?
Immediate feedback
Choose a decision, then test how the claim changes as evidence becomes stronger or weaker.
Try it yourself
Write one plain-English sentence explaining the main idea from this lesson.
Common mistakes
Check these before you move on.
Return to the lesson assumptions, units, diagnostics, and source evidence to replace this shortcut with a defensible interpretation.
Quick quiz
Which statement best answers the Chapter 46 opening question: Which tasks deserve the label AI, and which claims collapse when we ask what data, objective, and evaluation produced the result?
Quick quiz
Which practice should be avoided when applying Econometrics and Machine Learning: Different Questions, Shared Tools?
Quick quiz
What is the most defensible way to interpret the Python demonstration?
Quick quiz
Why does Chapter 46 matter in an applied econometrics workflow?
Key takeaway
AI is a broad family of systems, not one method. Machine learning estimates patterns by optimizing objectives on data. Fluency, accuracy, fairness, and safety require separate evaluation.