Skip to content
Tutorials Center
My learning

Topics

Lesson 7 of 46 ยท How Learning Works

Conditioning basics: classical and operant learning

Understand how we learn that signals predict events and that actions have consequences: Pavlov, Skinner, extinction, reinforcement schedules and the Rescorla-Wagner model.

Why does the smell of a certain perfume make your heart sink, or a song bring back a summer from ten years ago? Why do people keep checking their phones even when nothing important arrives? Why does a dog sit when it hears the treat bag? The simplest answer, in each case, is conditioning: the brain links events that go together, and actions with what follows them.

Conditioning is the oldest and best-studied kind of learning in psychology, and it is not just for animals. It operates in classrooms, apps, advertising, habits and emotional reactions. In this lesson you will learn the two main types, the vocabulary that scientists use to describe them, a famous mathematical model of how associations grow, and the limits of the approach.

Three cards showing before, during and after classical conditioning
Classical conditioning in three steps: a reflex and a neutral cue, repeated pairing, then a cue with new power.

What you will learn

  • The parts of classical conditioning (US, UR, CS, CR) and its main phenomena.
  • How the Rescorla-Wagner model explains why prediction error drives learning.
  • The difference between reinforcement and punishment, and why people confuse them.
  • What reinforcement schedules are and why some produce persistent behavior.
  • The limits and ethics of conditioning research.

Key terms

Unconditioned stimulus (US) and unconditioned response (UR): a stimulus that automatically triggers a response, such as food and salivation.

Conditioned stimulus (CS) and conditioned response (CR): a formerly neutral cue and the learned response it comes to trigger.

Reinforcement: a consequence that makes a behavior more likely. Punishment: a consequence that makes it less likely.

Extinction: the weakening of a learned response when the expected outcome stops happening.

Schedule of reinforcement: the rule that decides which responses get a reward.

Classical conditioning: signals that predict

Ivan Pavlov noticed that dogs in his laboratory began to salivate at the sound of a person approaching with food. He then tested the effect in controlled experiments. Food is an unconditioned stimulus (US): it triggers salivation automatically, with no learning needed. The salivation is the unconditioned response (UR). A neutral signal, such as a bell, does nothing at first. If the bell repeatedly sounds just before the food, the bell alone begins to trigger salivation. Now the bell is a conditioned stimulus (CS) and the salivation to it is a conditioned response (CR).

Researchers describe several effects that you can also observe in everyday life.

  • Acquisition. The CS-US pairing builds the response. It usually grows quickly at first and then levels off.
  • Extinction. If the CS keeps appearing without the US, the CR fades. Extinction is new learning (the cue now predicts nothing), not erasure. We know this because of the next effect.
  • Spontaneous recovery. After a rest, the extinguished response can partially return.
  • Generalization and discrimination. After conditioning to one bell tone, a similar tone also triggers a response (generalization). With training, the animal can learn to respond to one tone but not the other (discrimination).
  • Higher-order conditioning. A CS can serve as the US for a new cue.

Classical conditioning explains many emotional reactions, from fear to craving. John B. Watson and Rosalie Rayner's 1920 study of "Little Albert", in which an infant was conditioned to fear a white rat, is famous in textbooks, but it is also a lesson in research ethics: the study would not be allowed today, its procedures were weaker than often described, and the boy was never helped to unlearn the fear. Modern therapy for phobias uses the opposite process, gentle repeated exposure, which relies on extinction.

Why prediction matters: blocking and Rescorla-Wagner

Pairing alone is not enough. Leon Kamin (1969) showed a phenomenon called blocking. First, animals learn that a light predicts a shock. Then a tone is added, and light plus tone together are followed by the shock. Afterward, the tone alone produces little response. The tone had been paired with the shock many times, yet it was "blocked" because the light already predicted the shock, so there was nothing new for the tone to explain.

In 1972 Robert Rescorla and Allan Wagner proposed a simple rule that captures this. On each trial, the learner compares what it expected with what happened. The size of the surprise (prediction error) drives learning:

change in V = alpha x beta x (lambda - total V of all cues present)

Here V is the strength of the association for a cue, lambda is the maximum strength the outcome can support, and alpha and beta are learning-rate constants. When the US is a surprise (total V is low), learning is quick. When it is already predicted (total V near lambda), learning stops. Prediction error is also reflected in the activity of dopamine neurons, a finding that links this 1970s model to modern neuroscience and machine learning.

Not every association is equally easy. John Garcia and Robert Koelling (1966) found that rats readily link nausea to a taste, even with hours between them, but not to a sound or light. This taste aversion shows that evolution shapes what is easy to learn. It is also why one unlucky meal can put you off a food for years.

Operant conditioning: actions and consequences

In classical conditioning, the learner is passive. In operant conditioning, the learner acts, and what happens next changes the chance of repeating the act. Thorndike's law of effect was the starting point; B. F. Skinner developed the method.

There are four basic consequences, and people often mix them up.

Something is added Something is removed
Behavior increases Positive reinforcement (praise after a good answer) Negative reinforcement (a painkiller removes a headache, so you take it again)
Behavior decreases Positive punishment (a fine for speeding) Negative punishment (losing a privilege)

"Positive" and "negative" here mean "added" and "removed", not "good" and "bad". Negative reinforcement is not punishment: it increases behavior by taking something unpleasant away.

Skinner also studied shaping: rewarding successive approximations of a target behavior. That is how animals learn complex tricks, and how a good teacher or coach breaks a skill into steps and reinforces progress.

Schedules of reinforcement

Reinforcement does not have to follow every response. The rule that decides is a schedule.

  • Fixed ratio (FR): every n-th response is reinforced (a bonus after ten sales). Produces fast responding with pauses after each reward.
  • Variable ratio (VR): a reward after an unpredictable number of responses (slot machines, social media feeds). Produces high, steady rates and strong resistance to extinction.
  • Fixed interval (FI): the first response after a fixed time is rewarded (a weekly paycheck). Responding speeds up near the end of each interval.
  • Variable interval (VI): the first response after an unpredictable time is rewarded (checking your email). Produces slow, steady responding.

Behavior learned under partial reinforcement is harder to extinguish than behavior reinforced every time. This partial reinforcement extinction effect helps explain why people persist at things that pay off only now and then, and why intermittent rewards are used (sometimes ethically, sometimes not) in game and app design.

Using conditioning in learning

Teachers use reinforcement all the time: immediate feedback, praise for effort, points and badges. The research suggests some cautions. Rewards work best when specific, honest and tied to progress. Overuse of external rewards for tasks learners already enjoy can reduce interest in some situations (the overjustification effect, covered in chapter 4). Punishment tends to teach what not to do but not what to do instead, and may cause fear or avoidance of the subject.

Common misconceptions

"Negative reinforcement means punishment." It does not. Negative reinforcement removes something unpleasant and raises behavior.

"Extinction erases the learning." Spontaneous recovery and relapse show the original association is still there, with new learning layered on top.

"Conditioning only applies to animals." Humans show conditioned emotional responses, habits and cravings. But people also bring expectations and language, so human conditioning is not purely automatic.

"Pavlov rang a bell." Pavlov used many stimuli, including metronomes, lights and buzzers. The bell is the popular version.

Try it

First, a runnable Rescorla-Wagner model. The left panel shows a CS being paired with the US for 20 trials (acquisition) and then presented without it (extinction). The right panel shows blocking: with a light already trained, a new tone added later gains almost no strength, compared with a control that learned light and tone together from the start.

Python Rescorla-Wagner model: acquisition, extinction and blocking

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Second, a console experiment with reinforcement schedules. Simulated learners respond at three different rates for 120 seconds each. See which schedules reward faster responding and which do not. The simulation is deterministic (a fixed random seed), so you can compare runs.

JS Reinforcement schedules: who gets rewarded?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. In Pavlov's experiment, after conditioning, what is the bell?

    The bell was neutral at first and now triggers salivation because it predicts food, so it is a conditioned stimulus.
  2. 2. A student studies harder to avoid an annoying nagging reminder. This is:

    Removing something unpleasant (the nagging) increases the behavior (studying), which is negative reinforcement.
  3. 3. What does blocking show?

    Learning depends on surprise. If the outcome is already predicted, a new cue gains little.
  4. 4. Which schedule typically gives high, steady responding and strong resistance to extinction?

    Variable ratio schedules, like slot machines, produce persistent responding because the next reward could always be the next response.
  5. 5. Spontaneous recovery suggests that extinction is:

    The original association is still stored, so the response can return after a rest.

Summary

  • Classical conditioning links a neutral cue to a reflex-triggering stimulus through repeated pairing, driven by prediction error.
  • Extinction is new learning, and responses can recover spontaneously.
  • Operant conditioning shapes behavior with reinforcement and punishment; "negative" means removing, not bad.
  • Schedules matter: variable ratio schedules produce persistent behavior.
  • Conditioning is powerful but not the whole story; the next lesson covers learning by watching and thinking.

Next: Observational and cognitive learning