Skip to content

UWCCDL/PTSD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An ACT-R Model of Intrusive Memories in PTSD

This repository contains the code of an ACT-R model designed to capture the dynamics of intrusive memory retrievals in PTSD. This in an ongoing collaboration with Briana Smith of UW Bioengineering and Lori Zoellner of UW Psychology and UWCATS.

Theory and Description

This model is based on the Bayesian memory model developed by Anderson (1990) and currently implemented in the ACT-R cognitive architecture. Within this framework, In this model, the probability of retrieving a memory m is proportional to its activation A(m). A memory’s activation is, in turn, the sum of three components: a base-level activation B(m), a contextual or "spreading" activation S(m), and the emotional intensity of the memory at the time of its creation, I(m).

The base-level activation B(m) reflects the history of a memory. For each memory m, multiple traces i exist, each corresponding to an episode in which m was retrieved or re-encoded. The activation of each trace i decays with time, and the activation of m is the sum of the decaying activations of all its traces i:

B(m) = log ∑_i t(i)^-d

where t(i) is the time elapsed since the creation of i and d is an individual-specific rate of forgetting. The contextual activation S(m) is related to the associated strength sq,m between each current context’s cue q (that is, any feature the the current state of the environment) and m:

S(m) = ∑ q WS(q➝m)

Where W represents the amount of attention given to the context. The strength between cues and memories S(q➝m) is calculated through a Bayesian analysis, and reflects the probability of m being retrieved in the presence of q.

Finally, the emotional intensity of a memory is represented by the term γ I(m), where I(m) is the intensity (i.e., a metric summarizing arousal and value) of the memory at the moment of its creation and γ is free parameter that captures an individual’s specific recollection vividness. Thus, the final activation of a memory is

A(m) = B(m) + S(m) + γ I(m)

Biological Interpretation of the Model

Each of these terms can be put into correspondence with a specific brain circuit that is known to play a causal role in intrusive memories. Specifically, B(m) reflects the contribution of the hippocampus and the medial temporal lobe in memory encoding and maintenance; S(m) reflects the role of prefrontal-thalamic projections in guiding memory retrieval in the appropriate context; I(m) reflects the contribution of the amygdala to emotion processing and its effects on the hippocampus, and γ reflects the functional connectivity between the amygdala and the hippocampus.

Implementation

The model folder contains the current, "fast", Lisp-based implementation of the model. The implementation is based on the original Python/Lisp model that can still be found in he old folder. The fast implementation is needed because the Python code can run incredbly slow. Most of the addition time is spent in coordinated JSON RPC calls through TCP/IP protocol between the ACT-R core and the Python client.

To obviate this problem, the Python code was translated into Lisp, so that it can run faster and be integrated directly with ACT-R. The general priciples are as such:

  1. The pstd.lisp code mirrors the classes, methods, and structures of the ptsd.py file, including a high-level simulation class that manages simulations.

  2. All the original Python commands that track the model execution have been translated into equivalent ACT-R "hooks" Lisp functions.

  3. The ptsd-mdoel.lisp file contains the main ACT-R code that manage the model's cognitive cycle.

  4. All the commands setting have been removed from the ptsd-model.lisp file, and are instead set directly through Lisp code at the beginnig of every simulation (Note: this is clearly where the Lisp code diverges from the Python code)

Compatibility

The "fast" Lisp code is entirely incompatible with the Python code. You can use one or the other, but not both. In fact, the Lisp code assumes that no JSON RPC system even exists, and replaces all of the command calls with Lisp-level hook functions.

Usage

The only way to use the Fast code is through a Lisp interpreter, after ACT-R has been loaded. If you are using the Stand-Alone version of ACT-R, then you (obviously) do not need to load ACT-R. Otherwise, you need to load ACT-R by typing the following command on your REPL prompt:

(load "/path/to/actr/load-act-r.lisp")

To start a simulation, one must first load the ptsd file:

(load "ptsd.lisp")

This will automatically define all the necessary classes and methods for the simulations.

The next step is to then create an instance of a Simulation object:

(setf mysim (make-instance 'simulation))

At this point, the simulation parameters can be controlled by setting appropriate variables of the simulation object. For example, to create a simulation over V values of 2.0 and 5.0, with N = 100 runs per value, and a maximum duration of 100,000 seconds, one would type this:

(setf (ptev mysim) '(2 5))
(setf (n mysim) 100)
(setf (max-time mysim) 100000)

The entire simulation can be executed through the run-simulations method:

(run-simulations mysim)

(Note: the Lisp code run-simulations replaces the run method in Python. It had to be renamed because the run function is already defined by ACT-R).

Once the simulation is done, the data is saved in the TRACE variable of the mysim object. The trace can be saved to a file:

(save_trace mysim "mysim.txt")

Parameters

As in the Python code, the following parameters can be set for each simulation. This being Lisp code, none of the names are actually case-sensitive.

  • PTEV The "emotional" value of a traumatic memory. It can be set to either a number or to a list of numbers; in the latter case, the simulations will loop over the given values.

  • PTES The degree of similarity between the traumatic event and all the other events in memory. It can be set to either a number 0 <= n <=1, or to a list of numbers 0<= n <= 1; in the latter case, the simulations will loop over the given values. Similarity is controlled by selecting the slot values for the PTE from a different set. If similarity is 1.0, then all the slots of the PTE will come from the same set of slot values as the other events. If PTES = 0.0, on the other hand, the slots will come from a different set.

  • num_slots The number of slots in each chunk. These slots will be named slot1, slot2 ... slotN.

  • n: The number of runs for each combination of parameters. Must be a non-negative integer.

  • PTET: The (ACT-R) time (in seconds, starting 0.0) at which the PTE is scheduled to occur.

  • event_step: The distance between two consecutive situations being presented to the model.

  • model: The ACT-R model to be loaded and used for the simulation.

  • model_params: A dictionary of model parameters to be set in the model. These are supposed to be meaningful ACT-R parameters; no check is performed on their consistency.

Example code

The simulations.py file provide an example of script that can be used to generate Lisp code that manages and runs simulations. It contains a Lisp template that can be copied and personalized. In essence, simulations can be easily managed by looping through the desired parameters:

(load "load-act-r.lisp")
(load "ptsd.lisp")
(setf sim (make-instance 'simulation))
(setf (ptev sim) 
      '(1 20 10 5 15))
(setf (ptes sim)
      '(0 1 0.5 0.25 0.75))
(let ((ht (make-hash-table)))
  (setf (gethash :imaginal-activation ht) 10)
  (setf (gethash :bll ht) 7/10)
  (setf (model-params sim) ht))

(setf (logfile sim) "simulations_w=10_bll=0.6.txt") 
(run-simulations sim)
(quit)

Publications

The following publications are based on the model:

  • Smith, B. M., Chiu, M., Yang, Y. C., Sibert, C., & Stocco, A. (2020). Modeling the Effects of Post-Traumatic Stress on Hippocampal Volume. Proceedings of the 18th International Conference on Cognitive Modeling.

  • Smith, B. M., Thomasson, M., Yang, Y. C., Sibert, C., & Stocco, A. (2021). When Fear Shrinks the Brain: A Computational Model of the Effects of Posttraumatic Stress on Hippocampal Volume. Topics in Cognitive Science