nengo_spa.pointer¶
Classes
AbsorbingElement (n_dimensions[, vocab, algebra]) 
Absorbing element. 
Identity (n_dimensions[, vocab, algebra]) 
Identity element. 
SemanticPointer (data[, vocab, algebra, name]) 
A Semantic Pointer, based on Holographic Reduced Representations. 
Zero (n_dimensions[, vocab, algebra]) 
Zero element. 

class
nengo_spa.semantic_pointer.
SemanticPointer
(data, vocab=None, algebra=None, name=None)[source]¶ A Semantic Pointer, based on Holographic Reduced Representations.
Operators are overloaded so that
+
and
are addition,*
is circular convolution, and~
is the inversion operator.Parameters:  data (array_like) – The vector constituting the Semantic Pointer.
 vocab (Vocabulary, optional) – Vocabulary that the Semantic Pointer is considered to be part of. Mutually exclusive with the algebra argument.
 algebra (AbstractAlgebra, optional) – Algebra used to perform vector symbolic operations on the Semantic
Pointer. Defaults to
CircularConvolutionAlgebra
. Mutually exclusive with the vocab argument.  name (str, optional) – A name for the Semantic Pointer.

v
¶ The vector constituting the Semantic Pointer.
Type: array_like

algebra
¶ Algebra that defines the vector symbolic operations on this Semantic Pointer.
Type: AbstractAlgebra

vocab
¶ The vocabulary the this Semantic Pointer is considered to be part of.
Type: Vocabulary or None

name
¶ Name of the Semantic Pointer.
Type: str or None

normalized
()[source]¶ Normalize the Semantic Pointer and return it as a new object.
If the vector length is zero, the Semantic Pointer will be returned unchanged.
The original object is not modified.

unitary
()[source]¶ Make the Semantic Pointer unitary and return it as a new object.
The original object is not modified.
A unitary Semantic Pointer has the property that it does not change the length of Semantic Pointers it is bound with using circular convolution.

get_binding_matrix
(swap_inputs=False)[source]¶ Return the matrix that does a binding with this vector.
This should be such that
A*B == dot(A.get_binding_matrix(), B.v)
.

compare
(other)[source]¶ Return the similarity between two SemanticPointers.
This is the normalized dot product, or (equivalently), the cosine of the angle between the two vectors.

class
nengo_spa.semantic_pointer.
Identity
(n_dimensions, vocab=None, algebra=None)[source]¶ Bases:
nengo_spa.semantic_pointer.SemanticPointer
Identity element.
Parameters:  n_dimensions (int) – Dimensionality of the identity vector.
 vocab (Vocabulary, optional) – Vocabulary that the Semantic Pointer is considered to be part of. Mutually exclusive with the algebra argument.
 algebra (AbstractAlgebra, optional) – Algebra used to perform vector symbolic operations on the Semantic
Pointer. Defaults to
CircularConvolutionAlgebra
. Mutually exclusive with the vocab argument.

class
nengo_spa.semantic_pointer.
AbsorbingElement
(n_dimensions, vocab=None, algebra=None)[source]¶ Bases:
nengo_spa.semantic_pointer.SemanticPointer
Absorbing element.
If \(z\) denotes the absorbing element, \(v \circledast z = c z\), where \(v\) is a Semantic Pointer and \(c\) is a realvalued scalar. Furthermore \(\z\ = 1\).
Parameters:  n_dimensions (int) – Dimensionality of the identity vector.
 vocab (Vocabulary, optional) – Vocabulary that the Semantic Pointer is considered to be part of. Mutually exclusive with the algebra argument.
 algebra (AbstractAlgebra, optional) – Algebra used to perform vector symbolic operations on the Semantic
Pointer. Defaults to
CircularConvolutionAlgebra
. Mutually exclusive with the vocab argument.

class
nengo_spa.semantic_pointer.
Zero
(n_dimensions, vocab=None, algebra=None)[source]¶ Bases:
nengo_spa.semantic_pointer.SemanticPointer
Zero element.
Parameters:  n_dimensions (int) – Dimensionality of the identity vector.
 vocab (Vocabulary, optional) – Vocabulary that the Semantic Pointer is considered to be part of. Mutually exclusive with the algebra argument.
 algebra (AbstractAlgebra, optional) – Algebra used to perform vector symbolic operations on the Semantic
Pointer. Defaults to
CircularConvolutionAlgebra
. Mutually exclusive with the vocab argument.