Computational Cognitive Science - Lecture 2: Basic Model Building

Introduction
Modeling Working Memory
Basic Modeling Concepts
Computational Cognitive Science
Lecture 2: Basic Model Building
Frank Keller
School of Informatics
University of Edinburgh
[email protected]
September 23, 2016
Frank Keller
Computational Cognitive Science
1
Introduction
Modeling Working Memory
Basic Modeling Concepts
1
Introduction
2
Modeling Working Memory
144 Models of Working Memory
Fixed Decay
Variable Decay
3
Basic Modeling Concepts
Parameters
Discrepancy Function
Reading: Lewandowsky and Farrell (2011: Ch. 2).
Frank Keller
Computational Cognitive Science
2
Introduction
Modeling Working Memory
Basic Modeling Concepts
Working Memory
Working memory allows us to briefly remember chunks of
information (phone numbers, names, faces).
A standard account of working memory is Baddeley’s (1986)
model. Here, we will focus on the phonological loop in his model:
information in the loop decays rapidly over time;
memory content can be refreshed by articulatory rehearsal;
rehearsal is subject to articulatory suppression: when irrelevant
material is spoken during encoding, recall is worse.
Memory models are often tested in recall experiments in which
participants see lists of words, memorize them, and then recall
them as accurately as possible.
Frank Keller
Computational Cognitive Science
3
Introduction
Modeling Working Memory
Basic Modeling Concepts
Working Memory
Frank Keller
Computational Cognitive Science
4
Introduction
Modeling Working Memory
Basic Modeling Concepts
Working Memory
Word length effect (WLE):
shorter words are recalled better than long ones (higher
speech rate equals shorter word length);
explanation: short words can be rehearsed more often in the
same amount of time in the phonological loop.
Frank Keller
Computational Cognitive Science
5
Introduction
Modeling Working Memory
Basic Modeling Concepts
Working Memory
The phonological loop explains the WLE and many other findings
in the memory literature. However, the loop is not necessary or
sufficient for the WLE:
long words differ from short words in many ways (number of
syllables, frequency), so duration may not be the key factor;
alternative models without decay can also predict the effect.
Another key problem is that Baddeley’s account is at the level of a
verbal theory. There are many possible ways to instantiate this
theory in a computational model.
Frank Keller
Computational Cognitive Science
6
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
144 Models of Working Memory
To arrive at an implementable model, we need to clarify a number
of key assumption in the verbal theory:
How is order encoded? How do we make sure that items are
rehearsed and recalled in the correct order?
What is it that decays? It can’t be the actual knowledge of
words (that’s in long-term memory).
What kind of representations do we assume (distributed vs.
localized)?
In addition to this, we face a number of technical issues regarding
how to implement rehearsal and decay.
Frank Keller
Computational Cognitive Science
7
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
144 Models of Working Memory
There is a space of 144 possible models based on the following
implementation decisions:
Decisions Point
(1) Begin of decay
(2) Decay function
(3) Decay rate
(4) Recall success
(5) Recall errors
(6) Rehearsal sequence
N Alternatives
2
3
2
2
3
2
Our Decision
After list
Linear
Constant
Threshold
Omission only
Ordered
Not all of the models capture the data.
Frank Keller
Computational Cognitive Science
8
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
144 Models of Working Memory
1
Decay begins once the presentation of the word list is finished,
not at each individual word.
2
Decay is linear (rather than exponential or power-law).
3
Decay is constant, i.e., the same for each item for each
participant (rather than variable).
4
Recall is thresholded, i.e., once the activation of an item falls
below a certain value, it is forgotten.
5
Recall errors can only include omissions (items are forgotten),
not items in the wrong order or items that were not in the list.
6
Rehearsal is ordered, it consists of a recall of the complete list
in the order of presentation.
These decisions are often motivated by the need to keep the
implementation tractable.
Frank Keller
Computational Cognitive Science
9
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Matlab Implementation
Variable initialization:
clear all
nReps = 1000;
%number of replications
listLength = 5;
initAct = 1;
dRate = .8;
delay = 5;
minAct = .0;
%number of list items
%initial activation of items
%decay rate (per second)
%retention interval (seconds)
%minimum activation for recall
Frank Keller
Computational Cognitive Science
10
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Matlab Implementation
The main loop:
rRange = linspace(1.5,4.,15);
tRange = 1./rRange;
pCor = zeros(size(rRange));
i=1;
%index for word lengths
for tPerWord=tRange
for rep=1:nReps
actVals = ones(1,listLength)*initAct;
...
pCor(i) = pCor(i) + (sum(actVals>minAct)./listLength);
end
i=i+1;
end
Frank Keller
Computational Cognitive Science
11
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Matlab Implementation
rRange: speech rates from 1.5 to 4.0 (15 values);
tRange: time it takes to pronounce the items;
pCor: percentage correct for each speech rate;
tPerWord=tRange: iterates through the speech rates;
rep=1:nReps: iterates through the rehearsals;
actVals: activation values; initialized to initAct;
sum(actVals>minAct): determines which items have an
activation above minAct, computes percentage correct.
Frank Keller
Computational Cognitive Science
12
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Fixed Decay
The core: rehearsal and fixed decay:
cT = 0;
itemReh = 0; % start rehearsal
% with beginning of list
while cT < delay
intact = find(actVals>minAct);
% find the next item still accessible
itemReh = find(intact>itemReh, 1);
% rehearse or return to beginning of list
if isempty(itemReh)
itemReh=1;
end
actVals(itemReh) = initAct;
% everything decays
actVals = actVals - (dRate.*tPerWord);
cT=cT+tPerWord;
end
Frank Keller
Computational Cognitive Science
13
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Fixed Decay
cT: current time;
intact: extract all item that are accessible (activation higher
than minAct);
itemReh: find the next intact item to rehearse;
set its activation to initAct;
then decay all items (actVals) by dRate;
move on to the next word; tPerWord is the word duration;
continue until all the rehearsal time (delay) is used up.
Note that rehearsal and decay take place at the same time; cT is
advanced explicitly only at the end of the loop.
Frank Keller
Computational Cognitive Science
14
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Fixed Decay
Frank Keller
Computational Cognitive Science
15
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Modeling Result
Accuracy increases with speech rate, just as in the
experimental data; however, the increase is discontinuous;
discontinuity follows from forgetting of individual items when
they fall below threshold;
items can fall below threshold if they decay because the other
items on the list take too long to rehearse.
Frank Keller
Computational Cognitive Science
16
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Variable Decay
If we assume fixed decay then small variations in speech rate are
either amplified or nullified (above or below threshold), leading to
a step function.
Solution: add random component to decay (in second for-loop):
decRate = .8;
%mean decay rate (per second)
decSD = .1;
%standard deviation of decay rate
...
dRate = decRate+randn*decSD;
Frank Keller
Computational Cognitive Science
17
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Variable Decay
Frank Keller
Computational Cognitive Science
18
Introduction
Modeling Working Memory
Basic Modeling Concepts
144 Models of Working Memory
Fixed Decay
Variable Decay
Limitations and Extensions
Baddeley’s phonological loop model can be implemented and
predicts the word length effect. Possible extensions:
exponential decay instead of linear decay;
introduce mechanisms that explain transpositions (items in
recalled in wrong position) and intrusions (items recalled that
weren’t there during training);
explore the effect of the order in which items are rehearsed
(primacy effect).
Frank Keller
Computational Cognitive Science
19
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
Parameters
The behavior of a model is governed by parameters such as
initAct, dRate, minAct.
For instance, if we decrease dRate, the model will forget less. For
dRate = 0, speech rate no longer matters for recall.
We normally use θ to denote a parameter vector.
The more parameters a model contains, the more flexible it is in
fitting the data we’re trying to model.
Frank Keller
Computational Cognitive Science
20
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
Types of Parameters
Free parameters such as dRate:
can be adjusted until the predictions are in line with the data;
the process of adjusting free parameters is called parameter
estimation;
the resulting estimates are the best-fitting parameters.
Fixed parameters such as minAct:
are invariant across data sets, they are built into the model
architecture;
increasing their number is less problematic, as it doesn’t
improve model fit.
Frank Keller
Computational Cognitive Science
21
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
Discrepancy Function
Parameter estimation tries to minimize the discrepancy between
model predictions and data.
For this we need a discrepancy function (objective function, cost
function, error function).
Example: root mean squared deviation (RMSD):
s
PJ
2
j=1 (dj − pj )
RMSD =
J
where J is the number of data points, dj are the data points, and
pj are the model predictions for the data points.
Frank Keller
Computational Cognitive Science
22
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
Discrepancy Function
Frank Keller
Computational Cognitive Science
23
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
Discrepancy Function
If a model makes categorical predictions, other discrepancy
functions are more appropriate:
χ2 =
J
X
(Oj − N · pj )2
N · pj
j=1
G2 = 2
J
X
Oj log{Oj /(N · pj )}
j=1
where J is the number of categories, N the total number of
responses, and Oj the number of responses in category j, and pj
the model prediction for category j (a probability).
Next lecture: parameter estimation algorithms.
Frank Keller
Computational Cognitive Science
24
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
Summary
Models are often based on verbal theories;
example: Baddeley’s phonological loop model of working
memory;
we need to make assumptions about representations and
mechanisms in order to turn them into computational models;
in addition, implementational decisions need to be made;
example: we get 144 versions of the phonological loop model;
we saw a Matlab implementation of the model and compared
it to the experimental data;
key concepts in model buildings are: parameters, discrepancy
functions, and parameter estimation.
Frank Keller
Computational Cognitive Science
25
Introduction
Modeling Working Memory
Basic Modeling Concepts
Parameters
Discrepancy Function
References
Baddeley, Alan D. 1986. Working Memory . Oxford University Press, New York.
Lewandowsky, Stephan and Simon Farrell. 2011. Computational Modeling in
Cognition: Principles and Practice. Sage, Thousand Oaks, CA.
Frank Keller
Computational Cognitive Science
26