# KohonenMechanism¶

## Overview¶

A KohonenMechanism is a subclass of RecurrentTransferMechanism that implements a Kohonen network (brief explanation; nice demo), which is a particular form of self-organized map (SOM). By default, a KohonenMechanism uses a KohonenLearningMechanism and the Kohonen LearningFunction to implement implement a form of unsupervised learning that produces the self-organized map.

## Creating a KohonenMechanism¶

A KohonenMechanism can be created directly by calling its constructor.

TBD

TBD

TBD

## Class Reference¶

class psyneulink.library.components.mechanisms.processing.transfer.kohonenmechanism.KohonenMechanism(enable_learning=True, learning_function=Kohonen(distance_function=GAUSSIAN), learning_rate=None)

Subclass of TransferMechanism that learns a self-organized map of its input. See TransferMechanism for additional arguments and attributes.

Parameters
distance_function

determines the function used to evaluate the distance of each element from the most active one one identified by selection_function

Type

Function, function or method : default Gaussian

matrix

matrix parameter of the learned_projection.

Type

2d np.array

learning_enabled

indicates whether learning is enabled; see learning_enabled for additional details.

Type

bool

learning_rate

determines the learning rate used by the learning_function of the learning_mechanism (see learning_rate for details concerning specification and default value assignment).

Type

float, 1d or 2d np.array, or np.matrix of numeric values : default None

learned_projection

MappingProjection that projects to the Mechanism and is trained by its learning_mechanism.

Type

MappingProjection

learning_function

function used by learning_mechanism to update matrix of learned_projection <KohonenMechanism.learned_projection>.

Type

LearningFunction, function or method

learning_mechanism

created automatically if learning is specified, and used to train the learned_projection.

Type

LearningMechanism

output_ports

an OrderedDict with the following OutputPorts:

Type

Dict[str, OutputPort]

standard_output_ports

list of Standard OutputPort that includes the following in addition to the standard_output_ports of a TransferMechanism:

MAXIMUM_ACTIVITY1d array

“one hot” encoding of the most active element of the Mechanism’s value in the last execution.

Type

list[dict]

Returns

instance of KohonenMechanism

Return type

KohonenMechanism

_validate_params(request_set, target_set=None, context=None)

Validate FUNCTION and Mechanism params

_instantiate_attributes_after_function(context=None)

Determine numberr of items expected by termination_measure

configure_learning(learning_function=None, learning_rate=None, learned_projection=None, context=None)

Provide user-accessible-interface to _instantiate_learning_mechanism

Configure KohonenMechanism for learning. Creates the following Components:

• a Learning Mechanism – if the learning_function and/or learning_rate arguments are specified, they are used to construct the LearningMechanism, otherwise the values specified in the KohonenMechanism’s constructor are used;

_projection_added(projection, context=None)

Stub that can be overidden by subclasses that need to know when a projection is added to the Mechanism

property _dependent_components

Returns a set of Components that will be executed if this Component is executed

exception psyneulink.library.components.mechanisms.processing.transfer.kohonenmechanism.KohonenError`(error_value)