Sub topic 8
Generalization and Discrimination
This chapter assumes you know the core terms from earlier chapters: unconditioned stimulus (US), unconditioned response (UR), conditioned stimulus (CS), conditioned response (CR), and acquisition. It also assumes you can read a simple graph of responses across trials.
The problem: the world never repeats exactly
After acquisition, a CS predicts a US. But the CS never arrives in exactly the same form twice. A tone is a little louder, a dog's bark comes from a different direction, a face is lit differently. A learner that responded only to the exact training stimulus would be nearly useless. A learner that responded to everything would waste effort and make costly errors.
Two complementary processes solve this problem:
- Stimulus generalization is responding with the CR to stimuli that are similar to the trained CS, even though they were never paired with the US.
- Stimulus discrimination is responding with the CR to the CS but not to other, similar stimuli.
Both are products of the same learning machinery. Generalization is the default. Discrimination must be learned.
Stimulus generalization
Pavlov noticed that after a dog learned to salivate to a tone of one pitch, it also salivated to tones of other pitches, without any extra training. The closer the new tone was to the trained one, the stronger the response.
This pattern is called a generalization gradient: response strength falls off smoothly as a test stimulus becomes less similar to the CS.
The peak sits at the trained value. A steep gradient means narrow generalization. A flat gradient means broad generalization.
A classic human example
In the Little Albert study (1920), an infant was conditioned to fear a white rat by pairing it with a loud noise. He then showed fear of a white rabbit, a fur coat, and a Santa Claus mask. The study is now regarded as ethically unacceptable and methodologically weak, but it is still cited as an illustration of generalization. Treat the details as a teaching example, not as strong evidence.
Two kinds of similarity
Generalization is not only about physical resemblance.
- Physical generalization follows sensory similarity, such as pitch, color, or shape.
- Semantic generalization follows meaning. In experiments by Razran and others, people conditioned to a word such as "style" showed a response to words with related meanings, such as "fashion," more than to words that merely sound alike. Findings of this kind are reported in older studies, so treat the exact effects with some caution.
Stimulus discrimination
Discrimination training teaches the learner to tell stimuli apart. The standard procedure uses two stimuli:
- CS+ is paired with the US.
- CS− is presented without the US.
Over many trials, the CR to CS+ stays strong while the CR to CS− fades through extinction. The learner now responds selectively.
Discrimination can be pushed very far. Pavlov and his students trained dogs to tell a circle from an ellipse. When the ellipse was made progressively rounder, the dogs eventually could not tell the two apart.
Experimental neurosis
In that same circle-and-ellipse work, Pavlov reported that when the discrimination became too hard, the dogs showed agitation, barking, and refusal to cooperate. He called this experimental neurosis. It is a historical observation, and later researchers have disagreed about how well it models human anxiety, so it is best read as a finding about stress during impossible discriminations, not as a model of mental illness.
Modeling both with associative strength
The Rescorla-Wagner idea from the later chapter on blocking gives a neat way to think about this. Suppose each stimulus has its own associative strength, V. Then:
- Training with CS+ raises V for CS+.
- Because test stimuli share features with CS+, they inherit part of that strength. That is generalization.
- Training with CS− and no US produces negative prediction error, so V for the features that distinguish CS− falls. That is discrimination.
The code below makes this concrete. Each stimulus is a set of features. A feature shared is common to both tones, and high and low are unique to each tone. The response to a tone is the sum of the strengths of its features.
# Generalization and discrimination as feature learning (Rescorla-Wagner)
rate = 0.2
V = {"shared": 0.0, "high": 0.0, "low": 0.0}
def response(stimulus):
return sum(V[f] for f in stimulus)
def trial(stimulus, lam):
error = lam - response(stimulus)
for f in stimulus:
V[f] += rate * error
HIGH = ["shared", "high"] # CS+
LOW = ["shared", "low"] # CS-
# Phase 1: only the high tone is trained
for _ in range(30):
trial(HIGH, 1.0)
print("After phase 1")
print(" high tone:", round(response(HIGH), 2))
print(" low tone (never trained):", round(response(LOW), 2))
# Phase 2: discrimination training, high tone paired with US, low tone not
for _ in range(60):
trial(HIGH, 1.0)
trial(LOW, 0.0)
print("After phase 2")
print(" high tone:", round(response(HIGH), 2))
print(" low tone:", round(response(LOW), 2))After phase 1, the low tone produces nearly the same response as the high tone, because it shares the shared feature. This is generalization even though the low tone was never trained. After phase 2, the low feature has gone negative, which cancels the response to the low tone, while the high tone stays near 1. This is discrimination.
Factors that shape both processes
| Factor | Effect on generalization | Effect on discrimination |
|---|---|---|
| Greater similarity between stimuli | More generalization | Harder to learn |
| More discrimination training | Gradient becomes steeper | Sharper |
| Stronger or more intense US | Often broader generalization | Can be harder to establish |
| Passage of time since training | Often broader (memory becomes less specific) | Often weaker |
| Fear or anxiety conditioning | Often very broad | Impaired |
The last row matters in practice. After a frightening event, a person may fear many cues loosely related to it. This is sometimes called overgeneralization, and it is a feature of several anxiety conditions. The next chapters on emotional conditioning and exposure therapy return to this point.
Common errors
- Confusing generalization with a new association. The test stimulus was never paired with the US. The response comes from similarity to the trained CS.
- Treating discrimination as forgetting. The learner has not lost the CS+ association. It has learned an additional fact: the CS− predicts no US.
- Assuming the gradient is always symmetric. In real data, the gradient can be lopsided. Moving from the CS in one direction can matter more than in the other.
- Mixing up extinction and discrimination. Extinction removes the US after the CS. Discrimination does that only for the CS−, while CS+ continues to be reinforced.
Applying the idea
Suppose a child is bitten by a small brown dog.
- Acquisition: the dog (CS) is paired with pain and fright (US).
- Generalization: the child now fears a larger brown dog, then a tan dog, then a fluffy white one.
- Discrimination: if the child spends time around a friendly golden retriever and nothing bad happens, the fear to that dog fades while the fear of the original dog remains.
The same mechanism that spreads the fear can be used to narrow it.
Exercise
A dog is trained to salivate to a 1000 Hz tone (paired with food). Later, it salivates a lot to an 900 Hz tone and a little to a 600 Hz tone, though neither was ever paired with food. Then the experimenter plays 1000 Hz with food and 900 Hz without food for many trials. Name the phenomenon in the first part, the procedure in the second part, and predict the final result.
Show answer
The first part is stimulus generalization, with a gradient where response falls as the tone becomes less similar to 1000 Hz. The second part is discrimination training, with 1000 Hz as CS+ and 900 Hz as CS−. The final result is a strong CR to 1000 Hz and little or no CR to 900 Hz, because the response to 900 Hz extinguishes while 1000 Hz keeps being reinforced. The gradient becomes steeper around 1000 Hz.
Exercise
In the Python model, what would happen to the response to the low tone after phase 2 if the trial(LOW, 0.0) line were removed, and why?
Show answer
The low tone would keep a strong response, close to the response to the high tone. Without trials where the low tone occurs without the US, nothing drives the low feature below zero and the shared feature keeps its strength. The model would show generalization but no discrimination.