# EpisodicMemoryMechanism¶

## Overview¶

A EpisodicMemoryMechanism is an IntegratorFunction Function that can store and retrieve cue-associate pairs.

## Creating a TransferMechanism¶

An EpisodicMemoryMechanism is created by calling its constructor with cue_size and assoc_size that define the shapes of the items stored in its memory.

## Structure¶

A EpisodicMemoryMechanism has two InputStates, CUE_INPUT and ASSOC_INPUT, that represent an item to store; a function that stores and retrieves cue-assoc pairs from its memory; and two OutputStates, ASSOC_OUTPUT and CUE_OUTPUT that represent a retrieved item. The default function is a DND that implements a simple form of differentiable neural dictionary, but a custom function can be specified, so long as it meets the following requirements:

• It must accept a 2d array as its first argument, the first item of which is the cue and the second the associate.
• It must retur a 2d array, the first item of which is the retrieved associate and the cue with which it is associated in the function’s memory.

## Execution¶

When an EpisodicMemoryMechanism is executed, its function carries out the following operations:

• retrieve an item from its memory based on the value of its CUE_INPUT InputState and retrieval_prob; if no retrieval is made, appropriately shaped zero-valued arrays are assigned to the value of the ASSOC_OUTPUT and CUE_OUTPUT OutputStates.
• assign the value of the retrieved item’s assoc in the EpisodicMemoryMechanism’s ASSOC_OUTPUT OutputState, and the value of the cue of the retrieved item in the CUE_OUTPUT OutputState.

Note

The order of storage and retieval is determined by the function.

The value of the cue of the item retrieved from memory (and stored in CUE_OUTPUT) may be different than the value of CUE used to retrieve the item.

If no retrieval is made, appropriately shaped zero-valued arrays are assigned as the value of the ASSOC_OUTPUT and CUE_OUTPUT OutputStates.

## Class Reference¶

class psyneulink.library.components.mechanisms.processing.integrator.episodicmemorymechanism.EpisodicMemoryMechanism(cue_size=1, assoc_size=1, storage_prob=1.0 retrieval_prob=1.0 function=DND, params=None, name=None, prefs=None)

Subclass of IntegratorMechanism that implements a differentiable neural dictionary (DND)

Parameters: cue_size (int : default 1) – specifies length of the cue stored in the functions memory. assoc_size (int : default 1) – specifies length of the assoc stored in the functions memory. storage_prob (float : default 1.0) – specifies probability that the cue and assoc are stored in the function’s memory. retrieval_prob (float : default 1.0) – specifies probability that the cue and assoc are retrieved from the function’s memory. function (function : default DND) – specifies the function that implements a memory store and methods to store to and retrieve from it. It must take as its variable a 2d array, the first item of which is the cue and the second the associate to be stored in its memory, and must return a 2d array that is the value of the retriefved associate and the actual cue associated with it in memory. params (Dict[param keyword: param value] : default None) – a parameter dictionary that can be used to specify the parameters for the Mechanism, its function, and/or a custom function and its parameters. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor. name (str : default see name) – specifies the name of the EpisodicMemoryMechanism. prefs (PreferenceSet or specification dict : default Mechanism.classPreferences) – specifies the PreferenceSet for the EpisodicMemoryMechanism; see prefs for details.
storage_prob

float : default 1.0 – probability that cue and assoc are stored in the functions memory.

retrieval_prob

float : default 1.0 – probability that cue and assoc are retrieved from the functions memory; if no retrieval is made, appropriately-shaped zero-valued arrays are assigned to the the value of the ASSOC_OUTPUT and CUE_OUTPUT OutputStates (see <Structure <EpisodicMemoryMechanism_Structure>.

function

function : default DND – function that implements storage and retrieval from a memory.

name

str – the name of the EpisodicMemoryMechanism; if it is not specified in the name argument of the constructor, a default is assigned by MechanismRegistry (see Naming for conventions used for default and duplicate names).

prefs

PreferenceSet or specification dict – the PreferenceSet for the EpisodicMemoryMechanism; if it is not specified in the prefs argument of the constructor, a default is assigned using classPreferences` defined in __init__.py (see PreferenceSet for details).