# AutoAssociativeMechanism¶

## Overview¶

An AutoAssociativeLearningMechanism is a subclass of Learning Mechanism, modified for use with a RecurrentTransferMechanism to train its recurrent_projection.

## Creating an AutoAssociativeLearningMechanism¶

An AutoAssociativeLearningMechanism can be created directly by calling its constructor, but most commonly it is created automatically when a RecurrentTransferMechanism is configured for learning, (identified in its activity_source attribute).

## Structure¶

An AutoAssociativeLearningMechanism is identical to a Learning Mechanism in all respects except the following:

## Execution¶

An AutoAssociativeLearningMechanism executes in the same manner as standard Learning Mechanism, with two exceptions: * 1) its execution can be enabled or disabled by setting the learning_enabled

<RecurrentTransferMechanism.learning_enabled> attribute of the RecurrentTransferMechanism with which it is associated (identified in its activity_source attribute).

## Class Reference¶

psyneulink.library.components.mechanisms.adaptive.learning.autoassociativelearningmechanism.DefaultTrainingMechanism

alias of ObjectiveMechanism

class psyneulink.library.components.mechanisms.adaptive.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism(variable, function=Hebbian, learning_rate=None, learning_signals=LEARNING_SIGNAL, modulation=ModulationParam.ADDITIVE, params=None, name=None, prefs=None)

Implements a Learning Mechanism that modifies the matrix parameter of an AutoAssociativeProjection (typically the recurrent_projection of a RecurrentTransferMechanism).

Parameters: variable (List or 2d np.array : default None) – it must have a single item that corresponds to the value required by the AutoAssociativeLearningMechanism’s function; it must each be compatible (in number and type) with the value of the Mechanism’s InputState (see variable for additional details). learning_signals (List[parameter of Projection, ParameterState, Projection, tuple[str, Projection] or dict] : default None) – specifies the matrix to be learned (see learning_signals for details of specification). modulation (ModulationParam : default ModulationParam.ADDITIVE) – specifies the default form of modulation used by the AutoAssociativeLearningMechanism’s LearningSignals, unless they are individually specified. function (LearningFunction or function : default Hebbian) – specifies the function used to calculate the AutoAssociativeLearningMechanism’s learning_signal attribute. It must take as its variable argument a list or 1d array of numeric values (the “activity vector”) and return a list, 2d np.array or np.matrix representing a square matrix with dimensions that equal the length of its variable (the “weight change matrix”). learning_rate (float : default None) – specifies the learning rate for the AutoAssociativeLearningMechanism. (see learning_rate for details). params (Dict[param keyword: param value] : default None) – a parameter dictionary that specifies the parameters for the Projection, its function, and/or a custom function and its parameters. By default, it contains an entry for the Projection’s default function and parameter assignments. 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 AutoAssociativeLearningMechanism. prefs (PreferenceSet or specification dict : default Mechanism.classPreferences) – specifies the PreferenceSet for the AutoAssociativeLearningMechanism; see prefs for details.
variable

2d np.array – has a single item, that serves as the template for the input required by the AutoAssociativeLearningMechanism’s function, corresponding to the value of the activity_source.

activity_source

OutputState – the OutputState that is the sender of the AutoAssociativeProjection that the Mechanism trains.

input_states

ContentAddressableList[OutputState] – has a single item, that contains the AutoAssociativeLearningMechanism’s single ACTIVATION_INPUT InputState.

primary_learned_projection

AutoAssociativeProjection – the Projections with the matrix parameter being trained by the AutoAssociativeLearningMechanism. It is always the first Projection listed in the AutoAssociativeLearningMechanism’s learned_projections attribute.

learned_projections

List[MappingProjection] – all of the AutoAssociativeProjections modified by the AutoAssociativeLearningMechanism; the first item in the list is always the primary_learned_projection.

function

LearningFunction or function : default Hebbian – the function used to calculate the learning_signal (assigned to the AutoAssociativeLearningMechanism’s LearningSignal(s)). It’s variable must be a list or 1d np.array of numeric entries, corresponding in length to the AutoAssociativeLearningMechanism’s ACTIVATION_INPUT (primary) InputState.

learning_rate

float, 1d or 2d np.array, or np.matrix of numeric values : default None – determines the learning rate used by the AutoAssociativeLearningMechanism’s function to scale the weight change matrix it returns. If it is a scalar, it is used to multiply the weight change matrix; if it is a 2d array or matrix, it is used to Hadamard (elementwise) multiply the weight matrix (allowing the contribution of individual connections to be scaled); if it is a 1d np.array, it is used to Hadamard (elementwise) multiply the input to the function (i.e., the value of the AutoAssociativeLearningMechanism’s ACTIVATION_INPUT InputState, allowing the contribution of individual units to be scaled). If specified, the value supersedes the learning_rate assigned to any Process or System to which the AutoAssociativeLearningMechanism belongs. If it is None, then the learning_rate specified for the Process to which the AutoAssociativeLearningMechanism belongs belongs is used; and, if that is None, then the learning_rate for the System to which it belongs is used. If all are None, then the default_learning_rate for the function is used (see learning_rate for additional details).

learning_signal

2d ndarray or matrix of numeric values – the value returned by function, that specifies the changes to the weights of the matrix parameter for the AutoAssociativeLearningMechanism’slearned_projections <AutoAssociativeLearningMechanism.learned_projections>; It is assigned as the value of the AutoAssociativeLearningMechanism’s LearningSignal(s) and, in turn, its LearningProjection(s).

learning_signals

List[LearningSignal] – list of all of the LearningSignals for the AutoAssociativeLearningMechanism, each of which sends one or more LearningProjections to the ParameterState(s) for the matrix parameter of the AutoAssociativeProjection(s) trained by the AutoAssociativeLearningMechanism. Although in most instances an AutoAssociativeLearningMechanism is used to train a single AutoAssociativeProjection, like a standard Learning Mechanism, it can be assigned additional LearningSignals and/or LearningProjections to train additional ones; in such cases, the value for all of the LearningSignals is the the same: the AutoAssociativeLearningMechanism’s learning_signal attribute, based on its activity_source. Since LearningSignals are OutputStates, they are also listed in the AutoAssociativeLearningMechanism’s output_states attribute.

learning_projections

List[LearningProjection] – list of all of the LearningProjections <LearningProjection> from the AutoAssociativeLearningMechanism, listed in the order of the LearningSignals to which they belong (that is, in the order they are listed in the learning_signals attribute).

output_states

ContentAddressableList[OutputState] – list of the AutoAssociativeLearningMechanism’s OutputStates, beginning with its learning_signals, and followed by any additional (user-specified) OutputStates.

output_values

2d np.array – the first item is the value of the LearningMechanism’s learning_signal, followed by the values of any additional (user-specified) OutputStates.

modulation

ModulationParam – the default form of modulation used by the AutoAssociativeLearningMechanism’s LearningSignal(s), unless they are individually specified.

name

str – the name of the AutoAssociativeLearningMechanism; 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 AutoAssociativeLearningMechanism; 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).