Sub topic 5
Repetition and the habit strength curve
This chapter assumes you know that a habit is a response triggered by a cue in a stable context. It also assumes you can read a short Python function. Here we look at how repetition builds that cue-response link and what the growth looks like over time.
Why repetition matters
Each time you perform an action in the same context, the link between the context and the action gets a little stronger. Rewards help this learning, as the previous chapter explained. Repetition is what accumulates it.
Two details matter here:
- The repetition has to happen in the cue's context. Doing the action in many different places and at many different times strengthens the link to the cue much less.
- Strength is gradual. One repetition does not turn a choice into a habit, and no single repetition is the one that does.
A simple model
The model below treats habit strength as a number from 0 (no link) to 1 (fully automatic). Each repetition closes a fixed fraction of the remaining gap to 1.
def update_strength(strength, performed, rate=0.05):
"""Return the new habit strength (0 to 1) after one day.
Strength rises only when the action is performed in its usual context.
Each repetition closes a fixed fraction of the remaining gap to 1.
"""
if performed:
return strength + rate * (1 - strength)
return strength
strength = 0.0
for day in range(1, 8):
strength = update_strength(strength, performed=True)
print(day, round(strength, 3))The output starts at 1 0.05, then 2 0.098, and ends at 7 0.302. The first day adds 0.05. The seventh adds about 0.037. Early repetitions produce the biggest visible gains, and later ones add less because less of the gap is left.
Why there is no fixed number of days
The rate parameter stands for how fast a particular person learns a particular behaviour. Changing it changes how long the same curve takes to reach the same strength.
def days_to_threshold(threshold=0.95, rate=0.05, max_days=1000):
strength = 0.0
for day in range(1, max_days + 1):
strength += rate * (1 - strength)
if strength >= threshold:
return day
return None
print(days_to_threshold(0.95, 0.05)) # 59
print(days_to_threshold(0.95, 0.02)) # 149With a rate of 0.05 the threshold is reached on day 59. With a rate of 0.02 it takes 149 days. The curve has the same shape in both cases, but the time scale is different.
Rates differ for plausible reasons. A simple action, such as drinking a glass of water, is likely to build faster than a complex one, such as a full workout. A stable context and a rewarding action also help. This is why the next chapters treat timelines as ranges.
What the model leaves out
The model is an illustration of the curve's shape. It is not a measured result, and you should not use it to predict your own habit.
- No forgetting. In
update_strength, a missed day leaves strength unchanged. Real habits can weaken without practice, and a missed day in a stable context probably costs less than a long break. - No ceiling below 1. Real behaviour rarely reaches perfect automaticity.
- One fixed rate. Real learning speed can change with motivation, stress and how much the context varies.
- No context check. The function assumes
performed=Truemeans "in the usual context". In practice you have to ensure that yourself.
Common errors
- Expecting steady progress. Because gains shrink, the habit can feel stuck after a few weeks even though strength is still rising.
- Counting repetitions in varying contexts. Ten workouts at ten different times and places build a weaker link than ten workouts after the same cue.
- Treating a single miss as failure. In this model, a miss pauses growth and does not erase it.
- Reading the model's day counts as facts. The 59 days above come from the chosen rate, not from observation.
Exercise
Using the model, a learner has a rate of 0.02 and another has a rate of 0.05. Both aim for strength 0.95. Why does the first take much longer, and what does this say about quoting one number of days for everyone?
Show answer
With a smaller rate, each repetition closes a smaller fraction of the remaining gap, so the curve climbs more slowly (149 days against 59). The same curve shape can take very different times depending on the learner and the behaviour, so no single number of days fits everyone.