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

0% complete0 checkpoint streak
Progress tracking available after sign-in. Sign in to save your work.
Big question
Concept
Activity
Quiz

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

Question+data+assumptions+transparentPython>evidenceQuestion + data + assumptions + transparent Python -> evidence

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).

Table 27. Chapter reference.
System typeLearns from examples?Typical output
rule-based programNo, rules are codeddeterministic decision
regression modelYescontinuous prediction
classifierYesclass score or probability
generative modelYesnew content
retrieval systemIndexes examples/documentsranked evidence
agentMay combine models and toolsmulti-step action

Visual evidence

Figure 47. A simplified relationship among AI, machine learning, deep learning, and generative AI.
Figure 47. A simplified relationship among AI, machine learning, deep learning, and generative AI.

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

  1. Line 1Load a Python library needed for data work or regression.
  2. Line 2Load a Python library needed for data work or regression.
  3. Line 4Create or update a Python object used in the analysis.
  4. Line 5Create or update a Python object used in the analysis.
  5. Line 6Create or update a Python object used in the analysis.
  6. 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

  1. 1Re-run Demonstration 27.1 and change one input while keeping the analytical question fixed.
  2. 2Explain in two sentences how the output supports, or fails to support, the chapter opening question.
  3. 3Add one validation check that would prevent a plausible error.

Exercises

  1. 1Classify five everyday systems as rule-based, predictive, generative, retrieval, or agentic.
  2. 2Give one example of label bias.
  3. 3Design a verification checklist for AI-generated code.
  4. 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

  1. Line 1Run this Python instruction as part of the lesson workflow.
  2. Line 2Create or update a Python object used in the analysis.
  3. Line 4Run this Python instruction as part of the lesson workflow.
  4. Line 5Display a result so students can inspect the output.

Python walkthrough

  1. 1`def rule_based_income(income):`: Defines a reusable function with an explicit analytical purpose.
  2. 2`return "high" if income >= 70_000 else "not high"`: Creates or updates a named object used by later steps.
  3. 3`for value in [55_000, 72_000]:`: Repeats the indented calculation across observations or simulation draws.
  4. 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

Evidence strength: 55%
Training fluencyVerified generalization

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.