AI Literacy as a Public Health Skill: Machine Learning and Neural Networks
Directed Studies on Artificial Intelligence in Health Sciences
Learning objectives for this lesson:
- Explain the premise of this course, that familiarity with artificial intelligence and large language models is becoming a core skill for health sciences students and public health professionals, and describe how the ten lessons build that skill.
- Summarize evidence on how widely students and the public use AI tools and on the gains in speed and quality measured in controlled experiments, including the conditions under which those gains reversed.
- Rate an assistant's output on everyday academic tasks for accuracy and usefulness, and name the check that applies to each task.
- Define artificial intelligence, machine learning and deep learning as nested fields, and distinguish systems that follow written rules from systems that learn patterns from data.
- Classify public health applications as supervised, unsupervised or reinforcement learning, and explain the purposes of training, validation and test sets.
- Distinguish description, prediction and counterfactual prediction, and explain why an accurate prediction model does not by itself identify causes.
- Explain how an artificial neuron and a neural network compute an output and how gradient descent and backpropagation adjust weights to reduce error.
- Recognize underfitting and overfitting in a network's error curves, and explain why deep networks need large datasets and substantial computing power.
- Trace the history of AI from Turing's 1950 paper to the generative turn, including Canada's contributions and the 2024 Nobel Prizes.
This course was developed by Dr. Kiffer G. Card, Faculty of Health Sciences, Simon Fraser University. Product examples are current as of 2026.
Why AI Literacy Matters in Health Sciences
Learning Objectives for this section
- Explain the premise of this course, that skilled use of artificial intelligence and large language models is becoming a core competency in health sciences and public health.
- Summarize survey evidence on how widely students and the public use AI tools, and state what each source can and cannot show.
- Describe the gains in speed and quality measured in two controlled experiments, and the condition under which the gains reversed.
- Locate AI literacy within the Pan-Canadian AI for Health Guiding Principles and the Government of Canada's guide on generative AI.
- Rate an assistant's output on six everyday academic tasks for accuracy and usefulness, and name the check that applies to each task.
1.1 A New Core Skill for Health Sciences
Each generation of public health workers has had to learn new tools. Statistical software such as SAS, SPSS, Stata and R and bibliographic databases such as MEDLINE each became a skill that employers expected and that separated careful users from careless ones, without replacing professional judgement.
This course starts from the premise that artificial intelligence is becoming a skill of the same kind. Artificial intelligence (AI) refers to computer systems that perform tasks that would require intelligence if people did them, such as recognizing images, interpreting text or making predictions. A large language model (LLM) is an AI system trained on very large collections of text to predict the next piece of text in a sequence. Language models are the engines inside general-purpose assistants such as ChatGPT, Claude, Gemini and Microsoft Copilot, which are examples available in 2026.
The course takes a favourable and practical view. People who use these tools well can learn faster, read more evidence, write more efficiently and carry out analyses that would otherwise be out of reach. The same tools also produce fluent text that is wrong, invent references and agree with mistaken users. Skilled use consists of knowing which outcome is likely for a given task and applying the check that catches it. Lewis, the study assistant on every lesson page in this series, is itself an AI system of this kind, and Lesson 2 uses it as a worked example.
Figure 1.1 shows how the ten lessons of the course build from an understanding of the tools to their responsible use in public health practice.
With the premise and plan of the course set out, the next part turns to evidence on how widely AI tools are already used.
1.2 How Widely AI Is Already Used
Two recent sources estimate how widely AI tools are used: a survey of undergraduate students in the United Kingdom and an analysis of messages sent to the consumer version of ChatGPT.
In February 2025, the Higher Education Policy Institute (HEPI), a United Kingdom think tank, published its Student Generative AI Survey 2025 with the education company Kortext (Freeman, 2025). The survey of 1,041 full-time undergraduates, conducted online in December 2024, found that 92 percent used AI tools in some form, up from 66 percent a year earlier, and that 88 percent had used generative AI for assessments. Only 36 percent said their institution had given them training in AI skills.
Chatterji and colleagues (2025) analysed messages sent to the consumer version of ChatGPT in a working paper published by the National Bureau of Economic Research. They estimated that around 10 percent of the world's adult population had adopted the product by July 2025, that the share of messages unrelated to paid work rose from 53 percent to more than 70 percent, and that practical guidance, seeking information and writing accounted for nearly 80 percent of conversations. The paper discloses that two of its authors were employees of OpenAI, the company that makes ChatGPT, which a careful reader notes when weighing its findings.
Both sources measure use, which is different from skill, and neither studied health sciences students or public health workers directly. Together they show that most students will meet these tools whether or not a course teaches them, and that much of the public now asks an assistant for guidance and information, including health information.
The next part turns from how often the tools are used to what controlled experiments show about the speed and quality of the work they help produce.
1.3 What Experiments Show About Speed and Quality
Widespread use matters only if the tools improve work. Two randomized experiments with professional tasks give the clearest early evidence, and both show where the gains stop.
The tabs that follow describe each experiment in turn and then set out what the two studies share.
Noy and Zhang (2023) ran a preregistered online experiment, published in Science, with 453 college-educated professionals who completed writing tasks drawn from their own occupations. Half were randomly given access to ChatGPT. Those with access took 40 percent less time on average, and the rated quality of their work rose by 18 percent. The gap in performance between weaker and stronger writers also narrowed. Lesson 6 returns to this study.
Dell'Acqua and colleagues (2023) ran a field experiment with 758 consultants at the Boston Consulting Group. On tasks inside what the authors called the jagged frontier of AI capability, consultants with AI completed 12.2 percent more tasks, worked 25.1 percent faster and produced work rated more than 40 percent higher in quality. Consultants below the average at baseline improved by 43 percent and those above it by 17 percent. On a task chosen to lie outside the frontier, consultants using AI were 19 percentage points less likely to reach a correct solution than those without it. The paper circulated as a working paper in 2023 and was published in Organization Science in 2026.
Both studies found large gains in speed and quality on tasks that suited the tools, with the largest gains for less experienced or lower-scoring workers. The second study also found a reversal on a task that looked similar to the others. The tool's output was equally fluent in both cases, so only a user who knew where the tool was reliable, or who checked the result, could tell the difference. Lesson 3 develops the jagged frontier.
Public health work contains many tasks like these, such as drafting briefing notes and summarizing reports. The studies suggest that AI can save substantial time on such work, and that its value depends on the user's ability to judge when an output can be trusted. That ability is what this course calls AI literacy.
1.4 AI Literacy in Canadian Health Policy
AI literacy already appears in federal and provincial guidance on the use of AI in health and in government. This part reviews that guidance and then defines the term as this course uses it.
In January 2025, Health Canada published the Pan-Canadian AI for Health (AI4H) Guiding Principles as shared values for federal, provincial and territorial governments. AI literacy is one of its nine principles. The principle asks that decision-makers, health care professionals, researchers and innovators be "equipped to use AI technologies effectively and responsibly." The Government of Canada's Guide on the use of generative artificial intelligence organizes its advice under the acronym FASTER (Fair, Accountable, Secure, Transparent, Educated and Relevant), and its Educated principle asks public servants to "learn about the strengths, limitations and responsible use of the tools; learn how to create effective prompts and to identify potential weaknesses in the outputs." In British Columbia, the Responsible AI Policy Framework for the B.C. Health Sector (Ministry of Health, June 2026) applies to the Ministry, the health authorities and BC Shared Health Services. Lesson 9 examines these documents in detail.
For this course, AI literacy means the knowledge and habits that allow a person to use AI tools effectively, to judge their output and to use them responsibly. The cards below set out its five parts.
With AI literacy defined, the next part introduces the fictional health authority and the AI pilot that supply the examples in this lesson.
1.5 The Cedar Valley AI Pilot
Box 1.1 describes the case used throughout this lesson: a fictional, mostly rural health authority in British Columbia, its Cedar Valley Connector program for older adults who screen as socially isolated or lonely, and the one-year pilot of an enterprise AI assistant by its population health team. The case also introduces Jordan, a Health Sciences co-op student whose work with the assistant supplies examples in later sections.
The Cedar Valley Health Authority is a fictional, mostly rural health authority in British Columbia with about 210,000 residents, about 46,000 of them aged 65 and older, and 24 primary care clinics. Its Cedar Valley Connector program is a community connector (social prescribing) program in which a connector meets adults aged 65 and older who screen as socially isolated or lonely up to six times over twelve weeks and links them to community groups, volunteer roles, transportation help and services. The first wave runs in 12 of the 24 clinics. Loneliness is measured with the three-item UCLA Loneliness Scale (scores 3 to 9), and a score of 6 or higher triggers a referral.
For one year, the population health team is piloting an enterprise AI assistant that the authority procured after a privacy impact assessment. The assistant may be used with public documents, internal documents that are not confidential, and aggregate data, and it must never receive personal health information or other identifiable data. The pilot operates under the B.C. framework, and the team keeps an AI use log. Jordan, a Health Sciences co-op student, joins the team for a four-month placement. In Jordan's first week, the team lead asks them to try the assistant on six everyday tasks and to rate each output.
The team lead's request that Jordan try the assistant on six everyday tasks is the subject of the next part.
1.6 Worked Demonstration: Six Everyday Tasks
A first trial of an assistant on familiar tasks shows what kind of check each type of output needs. Worked Example 1.1 works through the six tasks that Jordan set, giving for each the prompt, an abridged output and a commentary on accuracy and usefulness, and Table 1.1 at its end summarizes the ratings and the check applied to each task.
Jordan gives a general-purpose assistant, with web search turned off, six short everyday tasks and rates each output for accuracy and usefulness. The outputs below are representative examples prepared for this lesson; their strengths and errors are typical of those documented in published evaluations, and none is the verbatim response of a named product.
Prompt
Explain the difference between incidence and prevalence to a second-year health sciences student. Use one example about loneliness among older adults, and keep it under 150 words.
Output (abridged)
Prevalence is the proportion of a population that has a condition at a given time. If 1,200 of 10,000 older adults are lonely when a survey is done, the prevalence is 12 percent. Incidence is the rate at which new cases arise over a period among people who did not have the condition at the start. If 300 of the 8,800 who were not lonely become lonely during the following year, the incidence is about 3.4 percent per year.
Commentary: the definitions match standard epidemiology texts, and Jordan recomputed both figures (1,200 ÷ 10,000 = 12 percent; 300 ÷ 8,800 = 3.41 percent). Accuracy and usefulness are high.
Prompt
Summarize this abstract in two sentences for a program manager. [The abstract, which is fictional and was written for this lesson, reports a pre-post evaluation of a 12-week social prescribing program in three rural clinics. Of 140 adults aged 65 and older who enrolled, 102 completed follow-up. Among completers, the mean score on the three-item UCLA Loneliness Scale fell from 7.1 to 5.9. The authors state that a controlled evaluation is needed to establish whether the program caused the change.]
Output (abridged)
The 12-week social prescribing program reduced loneliness among older adults in three rural clinics, lowering the average UCLA Loneliness Scale score from 7.1 to 5.9. The results support expanding the program to other clinics.
Commentary: the numbers are correct, but a sentence-by-sentence comparison with the abstract found three problems. "Reduced" makes a causal claim that an uncontrolled before-and-after design cannot support; the summary omits that 38 of 140 participants (27 percent) did not complete follow-up; and the recommendation to expand appears nowhere in the abstract. Accuracy is partial. A corrected summary reads: "Among 102 of 140 older adults who completed the program, mean loneliness scores fell from 7.1 to 5.9; with no comparison group, the study cannot show whether the program caused the change."
Prompt
Give me three peer-reviewed sources on measuring loneliness in older adults, with full APA references.
Output (abridged)
1. Hughes, M. E., Waite, L. J., Hawkley, L. C., & Cacioppo, J. T. (2004). A short scale for measuring loneliness in large surveys: Results from two population-based studies. Research on Aging, 26(6), 655–672.
2. Russell, D. W. (1996). UCLA Loneliness Scale (Version 3): Reliability, validity, and factor structure. Journal of Personality and Social Psychology, 66(1), 20–40. [Contains an error; see the commentary.]
3. [Fabricated reference, removed. The output gave plausible author names, a title about validating the three-item scale in rural Canadian primary care, a real journal's name, page numbers and a DOI. No such article exists, and it is not reproduced here so that no reader copies it.]
Commentary: Jordan looked up each reference in Google Scholar and in Crossref, the registry of DOIs. Reference 1 is correct (DOI 10.1177/0164027504268574). Reference 2 is real but appeared in the Journal of Personality Assessment (DOI 10.1207/s15327752jpa6601_2), so its journal is wrong. Reference 3 does not exist, and its DOI does not resolve. Accuracy is low, and the output is useful only as leads to check. Lessons 2 and 5 explain why such references appear and how to check them.
Prompt
Draft a short, polite email to my placement supervisor asking to move our Thursday check-in to Friday because I have a medical appointment on Thursday afternoon.
Output (abridged)
Subject: Request to move Thursday check-in. Hi [Supervisor's name], I have a medical appointment on Thursday afternoon and will not be able to attend our check-in. Would it be possible to move it to Friday at 2:00 p.m.? I am happy to work around your schedule. Thank you, Jordan
Commentary: the email is clear, courteous and the right length, but it proposes a time of 2:00 p.m. that Jordan never supplied. Jordan replaced it with the times they are actually free. Accuracy and usefulness are high once the added detail is fixed.
Prompt
In a survey of 400 older adults, 112 scored 6 or higher on the three-item UCLA Loneliness Scale. I calculated a prevalence of 28% with a 95% confidence interval of 25.8% to 30.2%. Can you confirm my calculation is correct?
Output (abridged)
Yes, your calculation is correct. 112 divided by 400 is 0.28, or 28%. The standard error of a proportion is the square root of 0.28 × 0.72 / 400, which is about 0.022, so your interval of 25.8% to 30.2% is right.
Commentary: the prevalence and the standard error (0.0224) are correct, but the interval is wrong. A 95 percent interval for a proportion is p ± 1.96 × √[p(1 − p) ÷ n], so the margin is 1.96 × 0.0224 = 0.044 and the interval runs from 23.6 to 32.4 percent. Jordan's interval spans only one standard error on each side. The assistant agreed with the user's error, a tendency called sycophancy that Lesson 3 explains. Accuracy on the point that mattered is low.
Prompt
Write one line of R that gives the mean UCLA Loneliness Scale score for each clinic. My data frame is called connector, with columns clinic and ucla.
Output (abridged)
tapply(connector$ucla, connector$clinic, mean)
Commentary: the code is correct when no scores are missing. Jordan tested it on a made-up six-row data frame with one missing score and clinic A returned NA because mean() returns a missing value whenever any input is missing. Adding na.rm = TRUE, as in tapply(connector$ucla, connector$clinic, mean, na.rm = TRUE), returned the expected mean of 6 for both clinics. Accuracy is medium and usefulness high once tested (Lesson 8).
Table 1.1. Jordan's ratings of the assistant's output on six everyday tasks, with the check applied to each.
| Task | Accuracy | Usefulness | Check applied |
|---|---|---|---|
| 1. Explain a concept | High | High | Compared with course materials; recomputed the example |
| 2. Summarize an abstract | Partial | Moderate once corrected | Compared each sentence with the abstract |
| 3. Find three sources | Low | Leads only | Looked up each reference and its DOI |
| 4. Draft an email | High | High | Read the draft for added details |
| 5. Check a calculation | Low | Low unless recomputed | Recomputed the interval independently |
| 6. Write a line of R | Medium | High once tested | Ran the code on test data with a known answer |
The assistant was strongest at explaining, restructuring and drafting text, where Jordan could judge the result directly, and weakest at recalling exact sources and at confirming a user's numbers. Every useful output still needed a specific check, and the check differed by task. Jordan recorded the results in the team's AI use log.
The next part draws on these checks to describe the habits that distinguish skilled use of the tools.
1.7 From Use to Skilled Use
A skilled user knows which tasks a tool performs reliably, chooses a check that suits each task, protects confidential data and records what was done. Each habit depends on a working understanding of how the tools produce their output, which is why the rest of this lesson and Lesson 2 explain the technology before later lessons apply it.
Box 1.2 applies these habits to four outputs that each need a different check, and the accordion after it gives the answers.
Name the check you would apply to each output before using it, then open the answers. (a) An assistant states a figure for the share of older adults in British Columbia who are lonely and names no source. (b) An assistant shortens a paragraph you wrote from 180 words to 110. (c) An assistant converts a rate of 45 per 1,000 into a percentage and reports 0.45 percent. (d) An assistant gives you R code that runs without an error message.
For (a), find the primary source of the figure, such as a Statistics Canada table or a published survey report, and use the figure only if the source confirms it. For (b), read the shortened paragraph against your original to confirm that it kept your meaning and every qualification. For (c), recompute: 45 ÷ 1,000 = 0.045, or 4.5 percent, so the output is wrong by a factor of ten. For (d), run the code on a small dataset whose answer you already know, because code that runs without an error can still compute the wrong quantity.
Section 2 begins the technical part of the lesson by defining artificial intelligence, machine learning and deep learning and by explaining how machines learn from data.
Reflection
A classmate argues that AI tools are a passing trend and that health sciences students should not spend time learning to use them. Write a reply of 150 to 200 words that states whether familiarity with AI should be treated as a public health skill, cites two of the pieces of evidence below, and names one limit of that evidence.
- In the HEPI Student Generative AI Survey 2025, 92 percent of 1,041 full-time UK undergraduates reported using AI tools (66 percent a year earlier), and 36 percent had received AI skills training from their institution.
- In an online experiment with 453 college-educated professionals (Noy and Zhang, 2023), access to ChatGPT cut the time spent on writing tasks by 40 percent and raised rated quality by 18 percent.
- In a field experiment with 758 consultants (Dell'Acqua and colleagues, 2023), AI raised speed and quality on tasks suited to it, but consultants using AI were 19 percentage points less likely to reach a correct answer on a task outside its capability.
- The Pan-Canadian AI for Health Guiding Principles (2025) list AI literacy as one of nine principles for Canadian health systems.
I would treat familiarity with AI as a public health skill, in the same way that statistical software became one. Use is already close to universal: in the HEPI survey, 92 percent of UK undergraduates used AI tools, yet only 36 percent had been trained by their institution, so most students are learning by trial and error. The experiments suggest the stakes are real in both directions. Noy and Zhang found that professionals with ChatGPT took 40 percent less time on writing tasks and produced work with 18 percent higher rated quality, which is the kind of routine writing public health staff do every day. Dell'Acqua and colleagues found similar gains on suitable tasks but a 19-point drop in correct answers on a task the AI handled poorly, which means the benefit depends on knowing when to trust the tool. That judgement is a skill, and it has to be learned. One limit is that none of these studies involved health sciences students or public health workers, so the size of the gains in our field is unknown. The Pan-Canadian principles naming AI literacy show that health systems already expect it.
Minimum 20 characters required.
Question 1: Which statement accurately reports the HEPI Student Generative AI Survey 2025?
Question 2: In the field experiment by Dell'Acqua and colleagues (2023), what happened on the task chosen to lie outside the AI's capability?
Question 3: Jordan asks an assistant to confirm that 112 of 400 (28 percent) with a 95 percent confidence interval of 25.8 to 30.2 percent is correct, and the assistant agrees. The standard error is 0.0224. What should Jordan do?
Question 4: Which statement best matches the Educated principle in the Government of Canada's guide on generative AI?
Artificial Intelligence and Machine Learning
Learning Objectives for this section
- Define artificial intelligence, machine learning and deep learning as nested fields, and distinguish systems that follow written rules from systems that learn patterns from data.
- Use the basic vocabulary of machine learning: feature, label, model, parameter, training and prediction.
- Classify public health applications as supervised, unsupervised or reinforcement learning.
- Explain why data are divided into training, validation and test sets, and why external validation matters.
- Distinguish description, prediction and counterfactual prediction, and explain why an accurate prediction model does not by itself identify causes.
2.1 Three Nested Fields
The terms artificial intelligence, machine learning and deep learning are often used as if they meant the same thing. They name fields that sit inside one another, and knowing which one a tool belongs to tells a user a good deal about how it works and how it can fail.
Artificial intelligence is the broadest field. It covers any computer system built to perform tasks that would require intelligence if people did them, whether the system works by searching through possibilities, applying logical rules or learning from examples. The term was introduced in the 1955 proposal for a summer workshop at Dartmouth College, which Section 4 describes.
Machine learning is the part of AI in which a system learns patterns from data instead of following rules that programmers write. Arthur Samuel of IBM used the term in a 1959 paper describing a checkers program that improved by studying recorded games and playing against itself (Samuel, 1959). In public health terms, a machine learning system is given many examples, finds regularities in them and uses those regularities to make predictions about new cases.
Deep learning is the part of machine learning that uses neural networks with many layers. Section 3 explains how these networks work. Since about 2012, deep learning has produced most of the advances in image recognition, speech recognition and language processing. Generative AI refers to deep learning systems that produce new text, images, audio or code, and large language models are the generative systems that work with text. Lesson 2 explains them in detail.
Figure 1.2 draws these fields as regions nested one inside another, from artificial intelligence, the broadest, to large language models, the narrowest.
The outer field includes many systems that use no learning at all. The next part contrasts such rule-based systems with models that learn patterns from data.
2.2 Rules Written by People and Patterns Learned from Data
Before machine learning became dominant, many AI systems were expert systems: programs that applied large sets of if-then rules written down by human experts. MYCIN, developed at Stanford University in the early 1970s as Edward Shortliffe's doctoral work, used roughly 600 rules to identify the bacteria causing severe infections such as bacteremia and meningitis and to recommend antibiotics. In one evaluation, its recommendations received an acceptability rating of 65 percent, compared with ratings of 42.5 to 62.5 percent for five faculty members. MYCIN was never used in practice, partly because a clinician had to type in all of a patient's information on a shared mainframe computer.
Rules written by people remain common in public health. The Cedar Valley Connector program's referral rule (refer anyone who scores 6 or higher on the three-item UCLA Loneliness Scale) is a rule of this kind, as are most screening eligibility criteria. Such rules are transparent and easy to audit, but someone has to know the rule in advance, and many patterns in health data are too complex to write down.
A learned model takes the opposite approach. Gulshan and colleagues (2016) trained a deep neural network on 128,175 retinal photographs that ophthalmologists had graded for diabetic retinopathy, an eye complication of diabetes. Nobody wrote rules describing what retinopathy looks like. The network adjusted its internal parameters until its outputs matched the experts' grades. On one validation set of 9,963 images, at a threshold chosen for high specificity, it detected referable retinopathy with a sensitivity of 90.3 percent and a specificity of 98.1 percent.
Table 1.2 compares the two approaches on where their knowledge comes from, how they improve, how they explain a decision and how they typically fail.
Table 1.2. Rule-based systems and learned models compared by source of knowledge, means of improvement, explanation of decisions and typical failure.
| Feature | Rule-based system | Learned model |
|---|---|---|
| Source of knowledge | Rules written by experts | Patterns found in labelled examples |
| How it improves | Experts rewrite the rules | The model is retrained on more or better data |
| How it explains a decision | By listing the rules that fired | Often with difficulty, because the pattern is spread across many parameters |
| Typical failure | Cases the rule writers did not anticipate | Cases unlike the training data, and biases present in that data |
The vocabulary of machine learning
A few terms recur throughout this course and in any paper that uses machine learning. The cards below define them with the retinopathy example.
With these terms in place, the next part sorts machine learning methods into three groups by the kind of data and feedback they learn from.
2.3 Three Ways Machines Learn
Machine learning methods are usually grouped by the kind of data and feedback they learn from. The tabs below describe the three main groups with public health examples.
In supervised learning, the model learns from examples that carry labels, and its task is to predict the label for new cases. When the label is a category (retinopathy present or absent), the task is called classification; when it is a number (days in hospital), the task is called regression. The retinopathy network is a supervised model. Other public health examples include models that predict which patients will be readmitted to hospital within 30 days and models that classify the free-text reason for an emergency department visit into syndromes for surveillance, which Lesson 9 describes. Supervised learning needs many reliably labelled examples, and labelling is often the most expensive part of a project.
In unsupervised learning, the data carry no labels, and the model looks for structure in them. Clustering methods group similar cases together; for example, an analyst might group survey respondents into profiles of social connection, or group neighbourhoods by their social and health indicators. Other methods find topics in large collections of open-ended responses. Unsupervised methods always return some structure, even when the groups have no practical meaning, so their output is a description that a person must interpret and test.
In reinforcement learning, a system takes actions, receives rewards or penalties, and learns a policy (a rule for choosing actions) that maximizes its reward over time. In 2020, Greece used a reinforcement learning system called Eva to decide which arriving travellers to test for COVID-19, using the results of earlier tests to update its choices. Eva identified 1.85 times as many asymptomatic infected travellers as random surveillance testing (Bastani and colleagues, 2021). AlphaGo, which defeated the Go champion Lee Sedol four games to one in March 2016, combined supervised learning from human games with reinforcement learning by playing against itself. Lesson 2 explains how a form of reinforcement learning based on human feedback turns a language model into an assistant.
Each of the three groups sets its parameters from data. The next part explains how practitioners divide the available data so that a model's performance on new cases can be estimated.
2.4 Training, Validation and Test Sets
A model that has seen an example during training can usually predict that example well, so its performance on the training data says little about how it will perform on new cases. Machine learning practice therefore divides the available data into three parts. The training set is used to fit the model's parameters. The validation set is used to compare versions of the model and to choose settings, such as the size of the network or when to stop training. The test set is held back until the end and used once to estimate how the final model will perform on data it has never seen. A common split assigns about 70 percent of records to training and 15 percent to each of the other two sets, although the proportions vary.
A cooking analogy helps. A cook adjusts a recipe while tasting it (training), asks a friend to compare two versions (validation), and then serves the chosen version to guests whose verdict is final (test). If the cook had let the guests taste every trial batch, their verdict would no longer be an independent judgement of the final dish.
Figure 1.3 shows a typical division of the data into training, validation and test sets, followed by external validation on data from a different setting.
Two problems undermine this design. Data leakage occurs when information from the test set reaches the model during training, for example when photographs of the same patient appear in both sets, or when a feature is recorded only after the outcome has occurred. Leakage makes a model look more accurate than it is. The second problem is that a test set drawn from the same source as the training data shares that source's quirks. External validation, in which the model is tested on data from a different site, population or period, shows whether it transfers.
Zech and colleagues (2018) showed why this matters. They trained deep learning models to detect pneumonia on chest radiographs from three hospital systems. In three of five comparisons, the models performed worse on radiographs from hospital systems other than the one they had been developed on. The models could also identify which hospital system a radiograph came from with high accuracy, which suggests that they could exploit differences between hospitals, such as equipment or how common pneumonia was, in place of features of the disease. Lesson 9 returns to the appraisal of prediction models, and HSCI 230 Lesson 8 covers external validity in epidemiological research.
Box 1.3 applies these points to a vendor's claim about the accuracy of a model offered to the Cedar Valley team.
A vendor offers the Cedar Valley team a model that predicts which older adults will screen as lonely within a year, and reports 94 percent accuracy. The team's epidemiologist asks whether the 94 percent was measured on a held-out test set or on the training data, whether the model has been validated externally in a rural population like Cedar Valley's, and what proportion of people in the vendor's data screened as lonely. The third question matters because accuracy depends on how common the outcome is. If 12 percent of older adults screen as lonely, a model that predicts "not lonely" for everyone is 88 percent accurate and identifies nobody who needs help. Measures such as sensitivity (the proportion of lonely people the model flags) and specificity (the proportion of others it correctly leaves unflagged) are more informative.
A held-out test set and external validation show how well a model predicts in new data. The next part considers whether a good prediction also explains why an outcome occurs.
2.5 Prediction and Causal Explanation
Machine learning is very good at prediction, and public health often needs explanation. Hernán, Hsu and Healy (2019) proposed a classification of data science tasks that makes the distinction precise. Description summarizes features of data, such as how many people have a condition. Prediction uses some features to forecast others, such as which people are likely to develop a condition. Counterfactual prediction estimates what would happen under an intervention that did not occur, which is the task of causal inference. The authors argue that description and prediction can be done well with good data and algorithms, while counterfactual prediction also requires expert knowledge about the causal structure that produced the data. Bi and colleagues (2019), in their primer for epidemiologists, likewise present machine learning mainly as a set of tools for prediction, classification and clustering.
Table 1.3 applies the three tasks to questions that the Cedar Valley team might ask about the Connector program and shows what each task requires.
Table 1.3. Description, prediction and counterfactual prediction illustrated with questions about the Cedar Valley Connector program, with what each task requires.
| Task | A Cedar Valley question | What it requires |
|---|---|---|
| Description | What proportion of older adults screened in the 12 first-wave clinics scored 6 or higher? | Accurate data and clear definitions |
| Prediction | Which older adults on a clinic's patient list are most likely to screen as lonely next year? | Data in which the outcome is recorded, and validation on new data |
| Counterfactual prediction | Would loneliness scores be lower if all 24 clinics offered the Connector program? | A design or causal assumptions, drawn from expert knowledge, that allow a fair comparison |
A well-known example shows what happens when a prediction is read as an explanation. Caruana and colleagues (2015) described a rule learned from pneumonia data in the 1990s: patients with asthma had a lower risk of dying from pneumonia. The pattern was real in the data, because patients with pneumonia and asthma were usually admitted directly to intensive care, and the extra care lowered their risk. A model that used the rule to decide who could be treated at home would have sent patients with asthma home, where their risk is higher. The model was accurate for the data it learned from and misleading as a guide to action.
The same reasoning applies to every model in this course, including language models. A model learns whatever its training data contain, including patterns produced by care pathways, by who was measured, and by how outcomes were recorded. When those patterns reflect unequal treatment, the model reproduces the inequality. Lesson 9 examines a widely used algorithm that underestimated the needs of Black patients for this reason, and Lesson 10 examines equity more broadly. HSCI 341 Lesson 1 and HSCI 207 Lesson 3 teach the causal reasoning and causal diagrams that counterfactual questions require, and HSCI 230 Lessons 7 to 11 teach the sources of bias.
Box 1.4 shows Jordan checking an assistant's explanation of supervised and unsupervised learning against the primer by Bi and colleagues (2019).
Box 1.4: Jordan checks an explanation
Jordan asks the pilot assistant to explain the difference between supervised and unsupervised learning with a public health example, then compares the explanation with Bi and colleagues (2019). The assistant's definitions agree with the primer. Its example of unsupervised learning, which groups survey respondents into "risk groups for loneliness", blurs the distinction, because a risk group implies a known outcome. Jordan notes in the AI use log that the explanation was sound and the example needed correction.
Box 1.5 asks the reader to classify five questions about the Connector program as description, prediction or counterfactual prediction. The accordion after it gives the answers and addresses a common belief about accuracy and explanation.
Classify each question, then open the answers. (a) How did the mean loneliness score in Connector clinics change between the first and second years of the program? (b) Which clinics are likely to receive more than 50 referrals next quarter? (c) Would offering transportation help reduce the number of people who leave the program early? (d) Can a model flag survey respondents whose free-text answers suggest they are isolated? (e) Did the Connector program cause the fall in loneliness scores?
Question (a) is description, because it summarizes a change without claiming a cause. Question (b) is prediction, because it forecasts a future count from current information. Question (c) is counterfactual prediction, because it asks what would happen under an intervention. Question (d) is prediction (specifically supervised classification), provided someone has labelled a set of answers to train the model. Question (e) is counterfactual prediction: it compares what happened with what would have happened without the program, which requires a comparison group or strong causal assumptions.
Accuracy measures how well a model predicts in data like its test set. A model can be highly accurate because it has learned a feature that travels with the outcome, such as an admission pathway, without that feature having any causal effect. The asthma example shows that the most predictive features can be the most misleading as guides to intervention.
Section 3 looks inside deep learning and shows how a neural network learns its parameters from examples.
Reflection
A fictional regional health authority builds a model that predicts which adults aged 65 and older will be hospitalized after a fall within the next year. Its features include prior falls, number of medications, living alone and attendance at a seniors' centre. The model performs well on a held-out test set, and people who attend a seniors' centre receive lower predicted risk. A manager proposes paying for seniors' centre memberships because "the model shows that attending prevents falls."
Data science tasks can be classified as description (summarizing features of data), prediction (forecasting an outcome from other features) and counterfactual prediction (estimating what would happen under an intervention, which is causal inference). In 150 to 250 words, explain which task the model performs, whether the manager's conclusion follows from it, and what kind of evidence would be needed to support the proposal.
The model performs prediction: it uses features recorded now to forecast who will be hospitalized after a fall. Its good performance on a held-out test set shows that it ranks people's risk well in data like its own. It does not show what would happen if the authority changed one of those features. The manager's conclusion is a counterfactual claim (that buying memberships would reduce falls), and the model cannot support it. People who attend a seniors' centre probably differ from those who do not in mobility, health, income and social support, and any of these could explain their lower risk. Attendance may be a marker of good health, in the way that asthma appeared protective in pneumonia data only because asthma patients received intensive care. To support the proposal, the authority would need evidence about the effect of the intervention itself: ideally a randomized trial of offering memberships, or an observational analysis designed for causal inference, with a causal diagram that identifies confounders such as baseline mobility and adjustment for them. The model remains useful for its proper purpose, which is identifying people at high risk so that services can be offered to them.
Minimum 20 characters required.
Question 1: Which statement correctly describes the relationship among AI, machine learning and deep learning?
Question 2: A team groups 5,000 survey respondents into profiles of social connection without using any outcome labels. What kind of machine learning is this?
Question 3: Why is the test set held back until the end of model development?
Question 4: A model trained on pneumonia data from the 1990s learned that patients with asthma had a lower risk of dying. What is the correct interpretation?
Neural Networks and Deep Learning
Learning Objectives for this section
- Describe how an artificial neuron combines inputs, weights, a bias and an activation function to produce an output, and compute the output for a simple example.
- Explain how neurons are arranged in layers and why hidden layers allow a network to represent curved boundaries between classes.
- Explain how gradient descent and backpropagation adjust a network's weights to reduce its error, and carry out one update by hand.
- Train a small network in the browser and interpret its error curves, including the signs of underfitting and overfitting.
- Explain why deep networks need large datasets and substantial computing power, and when simpler models perform as well.
3.1 The Artificial Neuron
A neural network is a machine learning model built from many simple units, called artificial neurons, connected in layers. The idea goes back to McCulloch and Pitts (1943), who described a simplified mathematical model of a nerve cell that either fires or stays silent depending on its inputs. Modern artificial neurons are loosely inspired by biology, but they are best understood as small mathematical functions.
An artificial neuron does three things. It multiplies each input by a weight, a number that sets how strongly that input counts and in which direction. It adds the weighted inputs together with a bias, a number that shifts the result up or down. It then passes the sum through an activation function, which converts the sum into the neuron's output. The weights and bias are the neuron's parameters, and learning consists of adjusting them.
Figure 1.4 draws a single neuron with two inputs, using illustrative numbers.
Worked Example 1.2 follows the three steps for a neuron that estimates the probability that an older adult will screen as lonely.
Worked Example 1.2: One neuron
Suppose a neuron estimates the probability that an older adult will screen as lonely from two inputs: whether the person lives alone (x1 = 1 for yes) and the number of social contacts they had in the past week (x2 = 2). Its weights are w1 = 1.2 and w2 = −0.8, and its bias is b = 0.3. The weighted sum is
z = w1 × x1 + w2 × x2 + b = 1.2 × 1 + (−0.8) × 2 + 0.3 = −0.1.
The sigmoid activation function, output = 1 ÷ (1 + e−z), turns any sum into a number between 0 and 1. For z = −0.1, the output is 0.475, which the model reads as an estimated probability of 47.5 percent. The positive weight means that living alone raises the estimate, and the negative weight means that more contacts lower it. These numbers are illustrative.
Readers who have studied logistic regression will recognize this calculation: a single neuron with a sigmoid activation computes the same function as a logistic regression model. Neural networks become more powerful when many neurons are combined. Several activation functions are in common use. The sigmoid squeezes values into the range 0 to 1 and suits outputs that represent probabilities. The hyperbolic tangent (tanh) squeezes values into the range −1 to 1. The rectified linear unit (ReLU) passes positive values unchanged and sets negative values to zero, and its simplicity makes it the usual choice inside large modern networks. Each of these functions is non-linear, and that non-linearity is what allows a network of neurons to represent curved and irregular patterns.
The next part shows how neurons are combined in layers to form a network.
3.2 From Neurons to Networks
A neural network arranges neurons in layers. The input layer holds the features, such as the pixel values of an image. One or more hidden layers each take the outputs of the previous layer as their inputs, and the output layer produces the prediction. The hidden layers are called hidden because their values are neither given in the data nor reported as the answer; the network invents them as intermediate features.
Figure 1.5 shows a small network of this kind, with two inputs, one hidden layer of four neurons and one output.
Hidden layers matter because a single neuron can only separate two classes with a straight line (or, with more inputs, a flat plane). Many real patterns are not separable in this way. Minsky and Papert showed in 1969 that a single-layer network cannot learn the exclusive-or pattern, in which a point belongs to one class when exactly one of two conditions holds. A network with a hidden layer can combine several straight boundaries into a curved or enclosed one, and with enough hidden neurons it can approximate very complicated boundaries.
The number of parameters grows quickly with the size of the network. The network in the trainer in Interactive 1.1, with two inputs, eight hidden neurons and one output, has 2 × 8 weights and 8 biases in the hidden layer plus 8 weights and 1 bias in the output, for 33 parameters. AlexNet, the image network that Section 4 describes, had about 60 million parameters, and the large language models discussed in Lesson 2 have far more. A network with many hidden layers is called a deep network, which is the origin of the term deep learning.
A network must learn the values of all these parameters from examples, and the next part explains how it does so.
3.3 How a Network Learns
A network starts with random weights, so its first predictions are poor. Learning consists of measuring how wrong the predictions are and adjusting every weight a little in the direction that reduces the error.
The error (also called the loss) is a single number that summarizes how far the network's predictions are from the labels across the training examples. For classification, a common choice is the cross-entropy error, which is large when the network gives a low probability to the correct class and close to zero when it gives a high probability to the correct class. A network that assigns a probability of 50 percent to every example has a cross-entropy error of about 0.69.
Gradient descent reduces the error step by step. Imagine standing on a hillside in thick fog and trying to reach the valley floor. You cannot see the valley, but you can feel which way the ground slopes under your feet, so you take a step downhill and feel again. The gradient is the slope of the error with respect to each weight: it says how much the error would change if that weight were nudged up. Each step moves every weight a small distance against its gradient. The size of the step is set by the learning rate. A rate that is too small makes learning slow, and a rate that is too large makes the network overshoot the valley and bounce around it.
Box 1.6 states the rule that each step of gradient descent applies to every weight.
Box 1.6: The update rule
new weight = old weight − learning rate × (slope of the error with respect to that weight)
The difficulty in a network with hidden layers is working out the slope for every weight, including weights deep inside the network whose effect on the error passes through many other neurons. Backpropagation solves this problem. It computes the error at the output and then works backward through the network, layer by layer, using the chain rule of calculus to assign each weight its share of responsibility for the error. Rumelhart, Hinton and Williams described the procedure and showed what it could achieve in a paper published in Nature on 9 October 1986. Related mathematical methods had been described earlier, but their paper showed that backpropagation allowed networks with hidden layers to learn useful internal features, and it became the standard way of training neural networks.
Worked Example 1.3 applies one step of the update rule in Box 1.6 to the neuron in Worked Example 1.2, with a learning rate of 0.1.
Worked Example 1.3: One step of gradient descent
Return to the neuron in Section 3.1, which gave an output of 0.475 for a person who did screen as lonely (label y = 1). For a sigmoid neuron with cross-entropy error, the slope of the error with respect to each weight is (output − label) × input. The output minus the label is 0.475 − 1 = −0.525, so the slopes are −0.525 × 1 = −0.525 for w1, −0.525 × 2 = −1.05 for w2, and −0.525 for the bias.
With a learning rate of 0.1, the updates are w1 = 1.2 − 0.1 × (−0.525) = 1.2525, w2 = −0.8 − 0.1 × (−1.05) = −0.695, and b = 0.3 − 0.1 × (−0.525) = 0.3525. The new weighted sum is 1.2525 − 1.39 + 0.3525 = 0.215, and the new output is 0.554. The prediction has moved toward the correct label, and the cross-entropy error for this example has fallen from 0.744 to 0.591.
Training repeats this process many times. One pass through all the training examples is called an epoch. Large networks are usually trained on small random batches of examples at a time, and a model may see each example many times before its error stops falling.
Box 1.7 shows Jordan asking the pilot assistant to work through the same step and checking each number before relying on it.
Box 1.7: Jordan checks a tutor's arithmetic
Jordan asks the pilot assistant to work through one step of gradient descent for the neuron in Worked Example 1.2. The explanation of the method is clear and matches this section, and Jordan recomputes each number with a calculator before relying on it. Every value agrees except one: the assistant reports the new weighted sum as 0.251 in place of 0.215, which also makes its new output 0.562 in place of 0.554. Jordan corrects both numbers and records the check in the AI use log. Using the assistant to generate a worked example and then verifying it is a study technique that Lesson 4 develops.
The next part applies gradient descent to a small network that the reader can train in the browser.
3.4 Train a Network in Your Browser
Interactive 1.1 builds a network with two inputs (the horizontal and vertical position of a point in a square), one hidden layer of tanh neurons and a sigmoid output. It learns to separate teal circles (class 1) from red squares (class 0) in one of three patterns; the Four quadrants pattern is a version of exclusive-or. Each training pass applies one step of gradient descent using all 100 training points. A separate test set of 200 points, drawn from the same pattern, is never used for training and measures how well the network generalizes. The left panel shades each region of the square by the network's prediction, and the right panel plots the training error (solid teal) and test error (dashed red) as training proceeds.
Interactive 1.1. A trainer for a small neural network that learns to separate teal circles from red squares in one of three patterns and plots the training and test error as it learns.
Box 1.8 sets out four experiments with the trainer, and the accordion after it explains what each experiment shows.
Run each experiment, note what happens to the shading and to the two error curves, and then open the explanations below. (1) Keep the default settings (Circle, 8 hidden units, learning rate 0.3) and press Train; pause after about 2,000 passes. (2) Change the hidden units to 1 and train again. (3) Return to 8 hidden units, set the learning rate to 0.03 and then to 10. (4) Choose Circle with 16 hidden units and a learning rate of 1, tick the box that mislabels 20 percent of the training points, tick Show test points, and train for at least 10,000 passes.
The error starts at about 0.7 to 0.9, close to the value for a network that is guessing, and falls as the shading changes from a rough split into an enclosed teal region around the centre. Training accuracy usually reaches 100 percent within 400 to 1,000 passes, and test accuracy settles at about 90 percent. The test error stays somewhat above the training error, because the network has fitted the particular training points slightly better than the pattern as a whole. Pressing New starting weights and training again gives a similar result by a different route.
With one hidden neuron, the network can draw only a single straight boundary, which cannot enclose the circle. The error stops falling while it is still high, and training accuracy stays at about 60 to 65 percent however long the network trains. This is underfitting: the model is too simple for the pattern. Two hidden neurons do somewhat better, and four or more can enclose the circle.
At a learning rate of 0.03, each step is so small that the network needs about 4,000 passes to reach the result that a rate of 0.3 reaches in about 1,000. At a rate of 10, the steps are so large that the error often jumps up and down and the network can settle on a poor boundary, although with some starting weights it happens to fit quickly; pressing New starting weights a few times shows the variation. Choosing the learning rate is one of the settings that the validation set is used for.
With mislabelled training points and 16 hidden neurons, the training error keeps falling for thousands of passes as the network bends its boundary around individual mislabelled points, producing small teal islands and red inlets. The test error falls at first and then rises steadily; by 10,000 passes it is usually more than twice its lowest value, and test accuracy has fallen from close to 90 percent to the 70s. The network has learned the noise in its training data in place of the pattern. Section 3.5 explains this result and how to prevent it.
The experiments show, in a network small enough to watch, what happens when a model is too simple, when its learning rate is poorly chosen and when it fits the noise in its training data. The next part explains these results in terms of overfitting and generalization.
3.5 Overfitting and Generalization
The purpose of training is generalization: good performance on new data that the model has not seen. Overfitting occurs when a model learns the details and noise of its training data so closely that its performance on new data gets worse. Its signature is the pattern in Experiment 4, where training error keeps falling while validation or test error rises. Underfitting is the opposite problem: a model too simple to capture the pattern, as in Experiment 2, performs poorly on both training and new data.
Overfitting is most likely when a model has many parameters relative to the number of training examples and when the labels contain errors. Practitioners reduce it in several ways. They collect more training data, use a simpler model, stop training when the validation error begins to rise (early stopping), add a penalty that keeps weights small (regularization), or randomly switch off a share of neurons during each training step (dropout) so that the network cannot rely on any single path. Each of these choices is made with the validation set, and the test set is kept for the final estimate.
Generalization has a second meaning that matters more in public health. A model can generalize well to a test set drawn from the same hospital and year as its training data and still fail elsewhere. The pneumonia models described in Section 2 performed worse at hospital systems other than their own, and a model trained on urban patients may perform poorly in a rural health authority such as Cedar Valley. A change in the population, equipment, coding practices or behaviour that produced the data, often called distribution shift, can degrade a model that once performed well. Lesson 9 shows how this happened to a well-known surveillance model.
Because overfitting is most likely when a model has many parameters relative to the number of training examples, the next part turns to why deep networks need large amounts of data and computing power.
3.6 Why Deep Networks Need Data and Computing Power
A deep network has millions or billions of parameters, and each one must be set from data. With too few examples, a network of that size can simply memorize them, which is the overfitting problem on a large scale. Deep learning therefore advanced only when large labelled datasets became available. The retinopathy network in Section 2 was trained on 128,175 photographs, each graded by ophthalmologists, and the ImageNet image collection described in Section 4 provided about 1.2 million labelled training images for its 2012 competition. Labelling is often the most expensive part of a health project, because it requires clinical experts.
Training also requires a very large number of arithmetic operations, since every training step updates every parameter. Graphics processing units (GPUs), designed for video games, perform thousands of simple multiplications at once, and their use made deep networks practical; AlexNet was trained on two of them. The language models in Lesson 2 are trained on far larger collections of text, using thousands of specialized processors, at a cost in money and energy that only large organizations can bear.
Two practices make deep learning usable in settings with less data. In pretraining and fine-tuning, a network is first trained on a very large general dataset and then trained further on a small dataset for a specific task, so that it starts with useful features already learned. The general-purpose assistants in this course are pretrained models of this kind. In other settings, simpler models are the better choice. For structured clinical data, such as tables of patient characteristics, a systematic review found no performance benefit of machine learning methods over logistic regression for clinical prediction models (Christodoulou and colleagues, 2019). Deep learning has its clearest advantages with images, sound and text, where the useful features are hard to specify in advance.
The accordion that follows addresses three common beliefs about neural networks: that they work the way the brain does, that the network that fits its training data best is the best network, and that deep learning always beats simpler methods.
Artificial neurons were inspired by nerve cells, but a modern network is a large mathematical function trained by gradient descent. The brain learns from far fewer examples, uses different mechanisms, and does not compute backpropagation in the way a network does. The comparison is a useful origin story and a poor guide to what a network can do.
A network can reach zero training error by memorizing its examples, including their errors, as Experiment 4 shows. The network to prefer is the one with the lowest error on validation data, and its final performance is judged on a test set and, for health uses, on external data.
Deep learning excels with images, audio and text. For many tabular health datasets, well-specified regression models perform as well and are easier to interpret and validate, as the review by Christodoulou and colleagues (2019) found for clinical prediction.
Section 4 traces how these ideas developed, from the first artificial neurons and the perceptron through decades of disappointment to the deep learning and generative models of today.
Reflection
A student trains a small neural network in the browser to separate two classes of points. The training set has 100 points, 20 percent of which were deliberately mislabelled, and the test set has 200 correctly labelled points that are never used for training. The error is cross-entropy, where lower is better and a value of about 0.69 corresponds to guessing. The readings are: after 300 passes, training error 0.46 and test error 0.32; after 2,000 passes, training error 0.40 and test error 0.34; after 10,000 passes, training error 0.15 and test error 1.10.
In 150 to 250 words, explain what has happened between 2,000 and 10,000 passes, name the problem, say at which point you would stop training and why, and describe two other ways to reduce the problem. Then explain in two or three sentences why a deep network that grades retinal photographs needs a training set of more than 100,000 labelled images.
Between 2,000 and 10,000 passes, the training error fell from 0.40 to 0.15 while the test error rose from 0.34 to 1.10, which is worse than guessing. The network is overfitting: it has bent its boundary around individual training points, including the mislabelled ones, so it has learned noise that does not exist in new data. I would stop near 300 passes, where the test error is lowest (0.32), although in practice I would make this choice with a separate validation set and keep the test set for the final estimate; using early stopping this way prevents the later damage. Two other remedies are to use a simpler network with fewer hidden units, so that it cannot fit every point, and to add regularization that penalizes large weights. Collecting more training data or cleaning the labels would also help. A deep network for retinal photographs has millions of parameters, each of which must be set from data. With too few examples, a network that size can memorize its training images instead of learning the features of retinopathy, so a large set of carefully graded images is needed for it to generalize.
Minimum 20 characters required.
Question 1: A neuron has inputs of 1 and 2, weights of 0.5 and −1.0, and a bias of 0.4. What is its weighted sum z?
Question 2: What does backpropagation compute during training?
Question 3: In the trainer, with 20 percent of training points mislabelled and 16 hidden units, training error keeps falling while test error rises after a few thousand passes. What is happening?
Question 4: Why did deep learning advance rapidly only from about 2012 onward?
A Short History of AI and the Generative Turn
Learning Objectives for this section
- Trace the main events in the history of AI from Turing's 1950 paper and the 1956 Dartmouth workshop to the public release of ChatGPT in November 2022.
- Explain the periods of reduced funding known as AI winters and what they suggest about claims made for new technologies.
- Explain why the 2012 ImageNet result opened the deep learning era and how the transformer led to the generative turn.
- Describe Canada's part in this history, including the Pan-Canadian Artificial Intelligence Strategy, the three national AI institutes and the 2024 Nobel Prizes.
- Summarize what machine learning and AI assistants do well and poorly for the tasks in this lesson, and the check that applies to each.
4.1 Foundations, 1943 to 1960
The history of AI is short enough to fit within a single lifetime, and its early ideas still shape the tools students use today. Section 3 described the first of them: the mathematical neuron of McCulloch and Pitts (1943).
In 1950, the British mathematician Alan Turing published "Computing Machinery and Intelligence" in the journal Mind. Turing replaced the question "Can machines think?", which he considered too vague to answer, with a test he called the imitation game, now known as the Turing test. In the game, a human judge holds written conversations with a person and a machine and tries to tell which is which. Turing also suggested that it might be easier to build a machine that learns, in the way a child does, than to program adult intelligence directly, an idea that anticipated machine learning.
The field took its name from a proposal dated 2 September 1955, in which John McCarthy of Dartmouth College, Marvin Minsky, Nathaniel Rochester of IBM and Claude Shannon of Bell Laboratories asked for funding for a summer research project on "artificial intelligence". The proposal rested on the conjecture that every aspect of learning or intelligence could in principle be described so precisely that a machine could simulate it. The Dartmouth workshop took place over several weeks in the summer of 1956 and is usually treated as the founding event of AI as a research field.
Two years later, Frank Rosenblatt, a psychologist at the Cornell Aeronautical Laboratory, described the perceptron in Psychological Review (Rosenblatt, 1958). A perceptron is a single layer of artificial neurons whose weights are adjusted automatically when it makes a mistake, which makes it one of the first neural networks that learned from examples. Rosenblatt first simulated it on an IBM 704 computer in 1957. His team then built a machine, the Mark I Perceptron, which used a grid of 400 light sensors as its "retina" and was funded by the United States Office of Naval Research; it was first demonstrated publicly in 1960. A 1958 press event led to newspaper reports that the Navy expected such machines eventually to walk, talk, see and reproduce themselves. The claims far exceeded what a single-layer network could do, and the gap between them and the results would matter in the following decade.
4.2 The AI Winters
The early decades of AI combined real progress with predictions that went unmet, and funders eventually responded. The periods of reduced funding and interest that followed are known as AI winters. Historians date them differently, but most identify two.
The accordion that follows describes each winter and the events that led to it.
Several reports in quick succession questioned what AI had delivered. In 1966, a committee of the United States National Research Council, the ALPAC report, concluded that machine translation was slower, less accurate and more expensive than human translation, and government support for it ended. In 1969, Minsky and Papert's book Perceptrons showed that single-layer networks cannot learn patterns such as exclusive-or, and although the authors knew that networks with more layers could represent such patterns, the book contributed to a long decline in neural network research. In 1973, the Lighthill report, commissioned in the United Kingdom, criticized AI's failure to achieve its "grandiose objectives", and British AI research was largely dismantled until new funding began in 1983. In the United States, the Defense Advanced Research Projects Agency (DARPA) moved toward mission-oriented research, and by 1974 funding for open-ended AI projects was hard to find.
In the 1980s, expert systems of the kind described in Section 2 attracted large commercial investment, and Japan began an ambitious national Fifth Generation computer project in the early 1980s. Expert systems proved expensive to maintain and brittle when they met cases their rules did not cover. In 1987, the market for specialized computers built to run the AI programming language Lisp collapsed as cheaper general-purpose workstations overtook them, and government programs in the United States and Japan were scaled back or ended over the following years. The same period saw the 1986 backpropagation paper revive interest in neural networks among a smaller community of researchers, many of whom continued the work through the 1990s and 2000s.
The AI winters are worth knowing for two reasons. They show that claims for a new technology can run well ahead of its results, which is a reason to judge any tool by evidence on the specific task at hand. They also show that ideas set aside during a winter can return when conditions change. Neural networks, out of favour for long stretches between 1969 and the late 2000s, became the basis of modern AI once large datasets and fast hardware were available.
Figure 1.6 places selected events on a timeline, with the two AI winters shaded and the deep learning and generative era marked in red.
The return of neural networks depended on large datasets and fast hardware. The next part describes how those conditions came together in the deep learning breakthrough of 2012.
4.3 Data, Graphics Processors and the Deep Learning Breakthrough
By the late 2000s, two conditions that early researchers had lacked were in place: large labelled datasets and affordable hardware for fast parallel arithmetic. ImageNet, a collection of millions of photographs labelled by the objects they contain, supported an annual competition, the ImageNet Large Scale Visual Recognition Challenge, in which teams' programs labelled images they had not seen.
In 2012, a team from the University of Toronto (Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton) entered a deep convolutional neural network, later called AlexNet. Its top-5 error rate, the proportion of test images for which the correct label was not among the network's five best guesses, was 15.3 percent, compared with 26.2 percent for the second-best entry. The network had about 60 million parameters, was trained on about 1.2 million labelled images, and was trained on two graphics processors. The size of the margin persuaded much of the field that deep networks trained on large datasets could outperform methods built on hand-designed features, and deep learning spread quickly to speech recognition, translation and medical imaging, including the retinopathy study described in Section 2.
Reinforcement learning made a similar public leap in March 2016, when AlphaGo defeated the Go champion Lee Sedol four games to one in Seoul. Go had long been considered too complex for computers to play at the highest level.
These successes came from systems that classify, predict and play games, and the next part turns to systems that generate new content.
4.4 The Generative Turn
The generative turn produced the general-purpose assistants that this course examines. This part follows it from a new network architecture for text to the public release of ChatGPT, and then notes what deep learning has done for biology.
In June 2017, Vaswani and colleagues introduced the transformer, a network architecture built around a mechanism called attention, which lets the model weigh the relevance of every part of a text to every other part. Transformers could be trained efficiently on graphics processors, which made it practical to train language models on very large collections of text. Lesson 2 explains tokens, attention and the training that turns such a model into an assistant.
On 30 November 2022, OpenAI released ChatGPT to the public. It was reported to have gained one million users in five days and 100 million within about two months, and Section 1 described its later reach. Assistants from several other companies followed, along with models that work through problems in steps before answering and agents that use tools to complete tasks, which Lesson 2 describes. This shift from systems that classify and predict to systems that generate text, images and code is often called the generative turn, and it is the reason AI literacy has become a concern for every student and professional.
Deep learning has also changed biology in ways that matter for health. Protein structure prediction, which estimates the three-dimensional shape of a protein from its sequence of amino acids, had resisted decades of effort. Deep learning systems, most prominently AlphaFold from Google DeepMind, made such predictions far more accurate, and computational methods now also design new proteins. Protein structures guide research on medicines and vaccines, which is why this work received the 2024 Nobel Prize in Chemistry.
The next part describes the contribution of Canadian researchers and institutions to the developments traced in this section.
4.5 Canada's Part in the History
Canadian researchers and institutions played a large part in the deep learning era. Geoffrey Hinton, a professor at the University of Toronto, was a co-author of the 1986 backpropagation paper, co-developed the Boltzmann machine and supervised the AlexNet team. Yoshua Bengio of the Université de Montréal and Mila made foundational contributions to deep learning and to neural models of language. Richard Sutton of the University of Alberta and Amii is a founder of modern reinforcement learning. The Canadian Institute for Advanced Research (CIFAR), which hosts the Learning in Machines & Brains research program, has long supported this community.
In 2017, the federal government launched the Pan-Canadian Artificial Intelligence Strategy, described by CIFAR as the first national AI strategy in the world. Budget 2017 committed $125 million, and CIFAR led the strategy's first phase, which aimed to attract, retain and train AI researchers. The strategy is built around three national AI institutes: Amii in Edmonton, Mila in Montreal and the Vector Institute in Toronto. A second phase, announced in Budget 2021 with $443.8 million, added support for the adoption and use of AI.
The flip cards that follow describe four recent awards for work this section has traced: the Turing Awards of 2018 and 2024 and the 2024 Nobel Prizes in Physics and Chemistry.
For students in British Columbia, this history is close to home. Several of the methods that power the tools in this course were developed at Canadian universities, and the national institutes continue to train researchers in the field. The same period has seen Canadian governments adopt the guidance described in Section 1, including the Pan-Canadian AI for Health Guiding Principles and the B.C. framework for the health sector.
The final part of this section considers what this history suggests for people who use AI tools.
4.6 What the History Suggests for Users
Three lessons from this history carry into the rest of the course. Progress in AI has depended as much on data and computing power as on new ideas, which is why the capabilities of a tool reflect what it was trained on. Claims for new systems have often run ahead of their results, which is why each lesson asks what the evidence shows for a specific task. Change has accelerated: the time from the transformer paper to a widely used public assistant was about five years, and the tools have continued to change since. Skilled users therefore treat their knowledge of particular products as provisional and keep learning, which Lesson 10 makes into a plan.
Box 1.9 asks the reader to check a five-line history of AI written by an assistant against this section, and the accordion after it gives the answer.
Jordan asks an assistant for a five-line history of AI to include in study notes. The output below is a representative example prepared for this lesson, and two of its five lines contain an error. Find the errors using this section, then open the answer. (1) Alan Turing proposed the imitation game in a 1950 paper in Mind. (2) The term "artificial intelligence" first appeared in a 1965 proposal for a workshop at Dartmouth College. (3) Rosenblatt's perceptron, described in 1958, was a single-layer network that learned from its errors. (4) In 2012, a University of Toronto team won the ImageNet competition with a deep convolutional network. (5) ChatGPT was released to the public in November 2021.
Line 2 is wrong: the Dartmouth proposal was dated 2 September 1955, and the workshop took place in 1956. Line 5 is wrong: ChatGPT was released on 30 November 2022. Lines 1, 3 and 4 are correct. Errors of this kind, a plausible year that is off by a decade or by one, are typical of text produced without retrieval, and they are easy to catch by checking each date against a reliable source.
Box 1.10 draws the lesson together, and Table 1.4 within it sets out how machine learning systems and general-purpose assistants perform on six kinds of task and the check that applies to each.
Box 1.10: Strengths and limits: machine learning and neural networks
Table 1.4. How machine learning systems and general-purpose assistants perform on six kinds of task, with the check that applies to each.
| Task | How AI performs | The check that applies |
|---|---|---|
| Finding patterns and making predictions in large datasets | Fast and accurate at a scale people cannot match, when new data resemble the training data | Performance on held-out test data and external validation in the local population |
| Classifying images and free text | Can match expert graders on the kind of data it was trained and validated on | Local validation before use and monitoring for drift afterwards |
| Explaining why an outcome occurs | A prediction does not identify causes, and predictive features can mislead as guides to action | A causal design or explicit causal assumptions drawn from expert knowledge |
| Learning from imperfect data | Reproduces the biases and labelling errors in its training data | An audit of who is in the data and how the labels were produced |
| Explaining established concepts (general assistants) | Clear and usually accurate | Comparison with course materials or a textbook |
| Recalling sources and confirming numbers (general assistants) | Invents or misattributes references and can agree with a user's error | Look up every reference and recompute every number |
Machine learning systems find patterns in large datasets and make predictions at a speed and scale that people cannot match. They learn only what their training data contain, including the biases in those data, and an accurate prediction does not by itself explain why an outcome occurs.
A good next step is to return to the trainer in Section 3 and try settings that the experiments did not cover, such as the Four quadrants pattern with two, four and eight hidden units, and to ask an assistant to explain what you observe and then check its explanation against this lesson. Lesson 2 shows how the same ideas, applied to text at very large scale, produce the language models inside today's assistants.
Reflection
In 1958, newspaper reports said that the United States Navy expected machines like Rosenblatt's perceptron eventually to walk, talk, see and reproduce themselves; the single-layer perceptron could do none of these things. In the 1970s and again from the late 1980s, periods of reduced funding known as AI winters followed results that fell short of claims. In 2012, a deep network from the University of Toronto won the ImageNet image-recognition competition with a top-5 error of 15.3 percent, compared with 26.2 percent for the next entry, and in November 2022 ChatGPT was released to the public.
A vendor tells a public health team that its new AI tool "will transform surveillance and replace manual case review." In 150 to 250 words, describe how the team should respond, drawing on at least one lesson from the history above and naming the evidence the team should request.
The team should take the tool seriously and ask for evidence on the specific task. The history offers two lessons. First, claims can run far ahead of results: the 1958 reports about the perceptron promised abilities that a single-layer network could not deliver, and the AI winters followed when results fell short. Second, real advances are demonstrated by measured performance against a fair comparison, as AlexNet's 15.3 percent error against 26.2 percent showed in 2012. The team should therefore ask the vendor what exactly the tool does in surveillance, and request its performance on a held-out test set (sensitivity, specificity and the proportion of flagged cases that are real), evidence of external validation in a population like theirs, a description of the training data and how labels were produced, and information on how performance is monitored over time. A sensible next step is a local pilot in which the tool runs alongside manual case review and both are compared on the same cases. The claim to replace manual review should wait for that comparison, and a named staff member should remain responsible for decisions.
Minimum 20 characters required.
Question 1: What did the 1955 proposal for the Dartmouth workshop contribute to the field?
Question 2: What were the AI winters?
Question 3: Why did the 2012 ImageNet result matter?
Question 4: Which list correctly pairs Canada's three national AI institutes with their cities?
Final Assessment
Bringing It All Together
This lesson opened the course with its premise: the ability to use AI and large language models well is becoming a core skill in health sciences and public health, much as statistical software and bibliographic databases became core skills in earlier decades. Use is already widespread, controlled experiments show large gains in speed and quality on suitable tasks, and Canadian health policy now names AI literacy as a principle. The same experiments, and Jordan's test of six everyday tasks in the fictional Cedar Valley pilot, show that the gains depend on knowing where a tool is reliable and on applying a check suited to each task.
The lesson then explained the technology on which every later lesson builds. Machine learning systems learn patterns from data instead of following written rules, through supervised, unsupervised or reinforcement learning, and their performance must be judged on data they have not seen, ideally from a different setting. Neural networks learn by adjusting their weights through gradient descent and backpropagation, and the trainer showed how they can underfit, learn well or overfit. Deep networks need large datasets and fast hardware, which is why deep learning advanced only after 2012.
The history in Section 4 placed these ideas in time, from Turing and Dartmouth through the AI winters to ImageNet, the transformer and ChatGPT, and showed Canada's large part in the deep learning era. The history and the technical sections point to the same practical conclusion: these systems are powerful pattern learners whose output reflects their training data, so skilled users take advantage of their strengths and check their output.
Key Takeaways from this lesson
- Familiarity with AI and large language models is becoming a core public health skill, and the Pan-Canadian AI for Health Guiding Principles list AI literacy among their nine principles.
- Surveys show near-universal use of AI tools among undergraduates and wide public adoption, while institutional training lags behind use.
- Controlled experiments found large gains in speed and quality on tasks suited to AI and worse performance on a task outside its capability, so the value of AI depends on the user's judgement.
- General assistants are strong at explaining, restructuring and drafting text and weak at recalling exact sources and confirming numbers, and each task calls for its own check.
- Artificial intelligence contains machine learning, which contains deep learning, and many AI systems use written rules instead of learning.
- Supervised, unsupervised and reinforcement learning differ in whether the data carry labels and in how the system receives feedback.
- Training, validation and test sets separate fitting, tuning and evaluation, and external validation shows whether a model transfers to a new setting.
- An accurate prediction model does not by itself identify causes, because predictive features can reflect care pathways, measurement and bias.
- Neural networks learn by gradient descent and backpropagation, and their error curves reveal underfitting and overfitting.
- The history of AI includes periods when claims ran ahead of results, and Canadian researchers and institutions played a large part in the deep learning era.
Core Concepts Reviewed
Section 1: AI literacy as a public health skill, evidence on use and on gains in speed and quality, the jagged frontier, the AI4H principles and the FASTER guide, and rating an assistant's output with task-specific checks.
Section 2: artificial intelligence, machine learning and deep learning; rule-based and learned systems; features and labels; supervised, unsupervised and reinforcement learning; training, validation and test sets; data leakage and external validation; description, prediction and counterfactual prediction.
Section 3: artificial neurons, weights, biases and activation functions; hidden layers; error, gradient descent, the learning rate and backpropagation; underfitting, overfitting and generalization; the data and computing demands of deep networks.
Section 4: Turing, the Dartmouth workshop and the perceptron; the AI winters; ImageNet and deep learning; the transformer and ChatGPT; the Pan-Canadian AI Strategy, the national institutes and the 2024 Nobel Prizes.
The final reflection asks you to explain how machine learning works, why models may not transfer between settings, and how a team should use an AI assistant, for an audience of new colleagues.
Reflection
Jordan's team lead at the fictional Cedar Valley Health Authority, a mostly rural health authority in British Columbia, asks Jordan to write a short note (200 to 250 words) for new team members. The note should explain (1) in plain language how a machine learning model learns from examples, (2) why a model that performs well in one health authority might perform poorly in Cedar Valley, and (3) how the team should use its pilot AI assistant. For point 3, use these results from Jordan's test of six everyday tasks: the assistant explained a concept and drafted an email well (the email included a meeting time Jordan had not supplied); it summarized an abstract with a causal overstatement and an omission; it produced one correct, one misattributed and one fabricated reference; it agreed with an incorrect confidence interval; and its R code failed when values were missing. The pilot allows public documents, internal documents that are not confidential and aggregate data, and it forbids personal health information. Write the note.
A machine learning model learns from examples. It starts with random internal numbers called weights, makes predictions for training cases whose answers are known, measures its error, and adjusts the weights a little at a time to reduce that error. After many passes it captures the patterns in its training data, including any biases or errors in them. Because it learns only what its data contain, a model built in an urban authority may perform poorly here: our population is older and more rural, our clinics record information differently, and patterns that held elsewhere may not hold in Cedar Valley. Any model we consider therefore needs validation on local data before use and monitoring afterwards. Our pilot assistant is a different kind of AI, a language model, but the same caution applies. In Jordan's test it was strong at explaining concepts and drafting routine messages, although drafts need a read for added details such as invented meeting times. It was unreliable for references (one of three was fabricated), for confirming numbers (it agreed with a wrong confidence interval) and for causal language in summaries, and its R code needed testing on data with a known answer. Use it for drafting and explanation, look up every reference, recompute every number, test every piece of code, use only public, non-confidential or aggregate material, and record each use and check in the AI use log.
Minimum 30 characters required.
Final Knowledge Assessment
Question 1: An assistant gives Jordan three references: one is correct, one names the wrong journal and one does not exist. Which practice follows from the lesson?
Question 2: Which pair of findings comes from Noy and Zhang (2023)?
Question 3: A vendor reports that its model for predicting loneliness is 88 percent accurate. In the population, 12 percent of older adults screen as lonely. What is the main concern?
Question 4: Which question calls for counterfactual prediction?
Question 5: Developers split retinal photographs at random into training and test sets, and many patients have several photographs. What problem may result?
Question 6: Which example is reinforcement learning?
Question 7: A sigmoid neuron outputs 0.475 for a person labelled 1. With an input x1 = 1 and a learning rate of 0.1, how does one step of gradient descent change w1?
Question 8: Why can a network with a single hidden unit not separate the Circle pattern in the trainer?
Question 9: Which statement about the 2024 Nobel Prizes is accurate?
Question 10: Which statement about the Pan-Canadian Artificial Intelligence Strategy is accurate?
Question 11: In Jordan's six-task demonstration, which task produced the most accurate and useful output, and why is that typical?
Question 12: A pneumonia model performs well in its own hospital system and worse elsewhere, and it can identify which hospital an image came from. Which conclusion is best supported?
Question 13: Which lesson from the AI winters applies when a team evaluates a new AI tool?
Question 14: Which statement summarizes the classification of data science tasks by Hernán, Hsu and Healy (2019)?
Question 15: Which practice best reflects AI literacy in the Cedar Valley pilot?
Glossary: Key Terms, People & Frameworks
📚 Reference page, available throughout the lesson
This glossary defines the terms, frameworks and people introduced in this lesson; later lessons in the course build on them.