CompetitiveGating#

class CompetitiveGating(input=None, values=None, salience=None, P=1, **kwargs)[source]#

Bases: object

A competitive attentional gating function, an attentional activation function, that incorporates stimulus salience in addition to the stimulus vector to modulate the weights. It formalises the hypothesis that each stimulus has an underlying salience that competes to captures attentional focus (Paskewitz and Jones, 2020; Kruschke, 2001).

Parameters:
inputarray_like

The input value. The stimulus representation (vector).

valuesarray_like

The values. A 2D array of values, where each row represents an outcome and each column represents a single stimulus.

saliencearray_like

The salience value. A 1D array of salience values, where each value represents the salience of a single stimulus.

Pfloat

The power value, also called attentional normalisation or brutality, which influences the degree of attentional competition.

Notes

The competitive gating function is defined as follows:

\[a = \frac{g}{||g||_p}\]

where \(g\) is the attentional gain, defined as the element-wise product of the stimulus vector and the salience vector, and \(||g||_p\) is the p-norm of the attentional gain:

\[||g||_p = \left(\sum_{i=1}^{n} g_i^p \right)^{1/p}\]

The parameter \(p\) controls the brutality of the competition between the stimuli. When \(p\) is close to 0, the competition is very brutal. When \(p\) is close to infinity, the competition is very mild, and all stimuli will receive attention proportional to their gain.

References

Kruschke, J. K. (2001). Toward a unified model of attention in associative learning. Journal of Mathematical Psychology, 45(6), 812-863.

Paskewitz, S., & Jones, M. (2020). Dissecting exit. Journal of mathematical psychology, 97, 102371.

Examples

>>> input = np.array([1, 1, 0])
>>> values = np.array([[0.1, 0.9, 0.8], [0.6, 0.2, 0.1]])
>>> salience = np.array([0.1, 0.2, 0.3])
>>> att = CompetitiveGating(input, values, salience, P = 1)
>>> att.compute()
array([[0.03333333, 0.6       , 0.        ],
       [0.2       , 0.13333333, 0.        ]])
compute()[source]#

Compute the activations mediated by underlying salience.

Returns:
array_like

The values updated with the attentional gain and stimulus vector.