MaskedMappingProjection

Overview

A MaskedMappingProjection is a subclass of MappingProjection that applies a specified mask array (either additively, multiplicatively, or exponentially) to the MappingProjection’s matrix each time the MappingProjection is executed. The mask is assigned a ParameterState and can thus be modulated by a ControlMechanism.

Creating a MaskedMappingProjection

A MaskedMappingProjection is created in the same way as a MappingProjection, with the exception that its constructor includes mask and mask_operation arguments that can be used to configure the mask and how it is applied to the Projection’s matrix. The mask attribute must be an array that has the same shape as the the matrix attribute, and the mask_operation argument must be the keyword ADD, MULTIPLY, or EXPONENTIATE (see Execution below).

Structure

A MaskedMappingProjection is identical to a MappingProjection, with the addition of mask and mask_operation attributes.

Execution

A MaskedMappingProjection executes in the same manner as a MappingProjection, with the exception that, each time the Projection is executed, its mask is applied to its matrix parameter as specified by its mask_operation attribute, before generating the Projection’s value.

Class Reference

class psyneulink.library.projections.pathway.maskedmappingprojection.MaskedMappingProjection(sender=None, receiver=None, matrix=DEFAULT_MATRIX, mask=None, mask_operation=MULTIPLY params=None, name=None, prefs=None)

Implement MappingProjection the matrix of which can be masked on each execution.

Parameters:
  • sender (Optional[OutputState or Mechanism]) – specifies the source of the Projection’s input. If a Mechanism is specified, its primary OutputState will be used. If it is not specified, it will be assigned in the context in which the Projection is used.
  • receiver (Optional[InputState or Mechanism]) – specifies the destination of the Projection’s output. If a Mechanism is specified, its primary InputState will be used. If it is not specified, it will be assigned in the context in which the Projection is used.
  • matrix (list, np.ndarray, np.matrix, function or keyword : default DEFAULT_MATRIX) – the matrix used by function (default: LinearCombination) to transform the value of the sender.
  • mask (int, float, list, np.ndarray or np.matrix : default None) – specifies a mask to be applied to the matrix each time the Projection is executed, in a manner specified by the mask_operation argument.
  • mask_operation (ADD, MULTIPLY, or EXPONENTIATE : default MULTIPLY) – specifies the manner in which the mask is applied to the matrix each time the Projection is executed.
  • params (Dict[param keyword: param value] : default None) – a parameter dictionary that can be used to specify 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 assignment (LinearCombination). Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.
  • name (str : default AutoAssociativeProjection-<index>) – a string used for the name of the AutoAssociativeProjection. When an AutoAssociativeProjection is created by a RecurrentTransferMechanism, its name is assigned “<name of RecurrentTransferMechanism> recurrent projection” (see Registry for conventions used in naming, including for default and duplicate names).
  • prefs (Optional[PreferenceSet or specification dict : Projection_Base.classPreferences]) – the PreferenceSet for the MappingProjection; if it is not specified, a default is assigned using classPreferences defined in __init__.py (see PreferenceSet for details).
componentType

MASKED_MAPPING_PROJECTION

sender

OutputState – identifies the source of the Projection’s input.

receiver

InputState – identifies the destination of the Projection.

matrix

2d np.ndarray – matrix used by function to transform input from the sender to the value provided to the receiver.

mask

int, float, list, np.ndarray or np.matrix : default None – mask applied to the matrix each time the Projection is executed, in a manner specified by mask_operation.

mask_operation : ADD, MULTIPLY, or EXPONENTIATE : default MULTIPLY determines the manner in which the mask is applied to the matrix when the Projection is executed.

value

np.ndarray – Output of AutoAssociativeProjection, transmitted to variable of receiver.

name

str – a string used for the name of the AutoAssociativeProjection (see Registry for conventions used in naming, including for default and duplicate names).

prefs

PreferenceSet or specification dict : Projection_Base.classPreferences – the PreferenceSet for AutoAssociativeProjection (see PreferenceSet for details).