Keywords¶
This module provides the string keywords used throughout psyneulink
https://princetonuniversity.github.io/PsyNeuLink/Keywords.html
- class psyneulink.core.globals.keywords.Loss(value)¶
Loss function used for learning.
Each keyword specifies a loss function used for learning in a Composition or AutodiffComposition, and the comparable loss functions used by
PyTorch
when an AutodiffComposition is executed inExecutionMode.PyTorch
mode.- L0¶
sum of errors: \(\sum\limits^{len}_i|target_i - output_i|\)
- SSE¶
sum of squared errors: \(\sum\limits^{len}_i(target_i - output_i)^2\)
- MSE¶
mean of squared errors: \(\frac{\sum\limits^{len}_i(target_i - output_i)^2}{len}\)
- CROSS_ENTROPY¶
cross entropy: \(\sum\limits^{len}_ioutput_i\log(target_i)\)
- KL_DIV¶
Kullback-Leibler (KL) divergence: \(\sum\limits^{len}_itarget_i\log{(\frac{target_i}{output_i})}\)
- NLL¶
Negative log likelihood loss: \(-{\log(target_i)}\)
- POISSON_NLL¶
- class psyneulink.core.globals.keywords.MatrixKeywords¶
- IDENTITY_MATRIX¶
a square matrix of 1’s along the diagonal, 0’s elsewhere; this requires that the length of the sender and receiver values are the same.
- HOLLOW_MATRIX¶
a square matrix of 0’s along the diagonal, 1’s elsewhere; this requires that the length of the sender and receiver values are the same.
- FULL_CONNECTIVITY_MATRIX¶
a matrix that has a number of rows equal to the length of the sender’s value, and a number of columns equal to the length of the receiver’s value, all the elements of which are 1’s.
- RANDOM_CONNECTIVITY_MATRIX¶
a matrix that has a number of rows equal to the length of the sender’s value, and a number of columns equal to the length of the receiver’s value, all the elements of which are filled with random values uniformly distributed between 0 and 1.
- AUTO_ASSIGN_MATRIX¶
if the sender and receiver are of equal length, an
IDENTITY_MATRIX
is assigned; otherwise, aFULL_CONNECTIVITY_MATRIX
is assigned.
- DEFAULT_MATRIX¶
used if no matrix specification is provided in the constructor; it presently assigns an
IDENTITY_MATRIX
.
- class psyneulink.core.globals.keywords.DistanceMetrics¶
Distance between two arrays.
Each keyword specifies a metric for the distance between two arrays, \(a_1\) and \(a_2\), of equal length for which len is their length, \(\bar{a}\) is the mean of an array, \(\sigma_{a}\) the standard deviation of an array, and \(w_{a_1a_2}\) a coupling coefficient (“weight”) between a pair of elements, one from each array:
- MAX_ABS_DIFF¶
\(d = \max(|a_1-a_2|)\)
- DIFFERENCE¶
(can also be referenced as L0)
\(d = \sum\limits^{len}(|a_1-a_2|)\)
- EUCLIDEAN¶
(can also be referenced as L1)
\(d = \sum\limits^{len}\sqrt{(a_1-a_2)^2}\)
- COSINE¶
\(d = 1 - \frac{\sum\limits^{len}a_1a_2}{\sqrt{\sum\limits^{len}a_1^2}\sqrt{\sum\limits^{len}a_2^2}}\)
- CORRELATION¶
\(d = 1 - \left|\frac{\sum\limits^{len}(a_1-\bar{a}_1)(a_2-\bar{a}_2)}{(len-1)\sigma_{a_1}\sigma_{ a_2}}\right|\)
- CROSS_ENTROPY¶
(can also be referenced as ENTROPY)
\(d = \sum\limits^{len}a_1log(a_2)\)
- ENERGY¶
\(d = -\frac{1}{2}\sum\limits_{i,j}a_{1_i}a_{2_j}w_{ij}\)