Math¶
This package contains modules related to mathematical, probabilistic and statistical data structures and simple algorithms.
The primary sub-modules include (use help on these modules for additional online documentation):
Stats¶
Module of statistical data structures and functions used in learning algorithms and for analysis of HTM network inputs and outputs.
-
nupic.math.stats.
All
(sequence)¶ Parameters: sequence – Any sequence whose elements can be evaluated as booleans. Returns: true if all elements of the sequence satisfy True and x.
-
nupic.math.stats.
Any
(sequence)¶ Tests much faster (30%) than bool(sum(bool(x) for x in sequence)).
Returns: (bool) true if any element of the sequence satisfies True. Parameters: sequence – Any sequence whose elements can be evaluated as booleans.
-
class
nupic.math.stats.
ConditionalProbabilityTable2D
(rowHint=None, ncols=None)¶ Holds frequencies in a 2D grid of bins. Binning is not performed automatically by this class. Bin updates must be done one row at a time. Based on nupic::SparseMatrix which is a compressed sparse row matrix. Number of columns cannot be changed once set. Number of rows may be increased. Also maintains the row and column sumProp distributions.
Constructor constructs a new empty histogram with no rows or columns.
Parameters: - rowHint – if specified, ncols must be specified (though not vice versa)
- ncols – if speicified, number of columns cannot be changed thereafter.
-
clean_outcpd
()¶ Hack to act like clean_outcpd on zeta1.TopLevelNode. Take the max element in each to column, set it to 1, and set all the other elements to 0. Only called by inferRowMaxProd() and only needed if an updateRow() has been called since the last clean_outcpd().
-
grow
(rows, cols)¶ Grows the histogram to have rows rows and cols columns. Must not have been initialized before, or already have the same number of columns. If rows is smaller than the current number of rows, does not shrink. Also updates the sizes of the row and column sums.
Parameters: - rows – Integer number of rows.
- cols – Integer number of columns.
-
inferRow
(distribution)¶ Computes the sumProp probability of each row given the input probability of each column. Normalizes the distribution in each column on the fly.
The semantics are as follows: If the distribution is P(col|e) where e is the evidence is col is the column, and the CPD represents P(row|col), then this calculates sum(P(col|e) P(row|col)) = P(row|e).
Parameters: distribution – Array of length equal to the number of columns. Returns: array of length equal to the number of rows.
-
inferRowCompat
(distribution)¶ Equivalent to the category inference of zeta1.TopLevel. Computes the max_prod (maximum component of a component-wise multiply) between the rows of the histogram and the incoming distribution. May be slow if the result of clean_outcpd() is not valid.
Parameters: distribution – Array of length equal to the number of columns. Returns: array of length equal to the number of rows.
-
inferRowEvidence
(distribution)¶ Computes the probability of evidence given each row from the probability of evidence given each column. Essentially, this just means that it sums probabilities over (normalized) rows. Normalizes the distribution over each row on the fly.
The semantics are as follows: If the distribution is P(e|col) where e is evidence and col is the column, and the CPD is of P(col|row), then this calculates sum(P(e|col) P(col|row)) = P(e|row).
Parameters: distribution – Array of length equal to the number of columns. Returns: array of length equal to the number of rows.
-
numColumns
()¶ Returns: (int) number of columns
-
numRows
()¶ Gets the number of rows in the histogram.
Returns: Integer number of rows.
-
updateRow
(row, distribution)¶ Add distribution to row row. Distribution should be an array of probabilities or counts.
Parameters: - row – Integer index of the row to add to. May be larger than the current number of rows, in which case the histogram grows.
- distribution – Array of length equal to the number of columns.
-
nupic.math.stats.
Distribution
(pos, size, counts, dtype)¶ Returns an array of length size and type dtype that is everywhere 0, except in the indices listed in sequence pos. The non-zero indices contain a normalized distribution based on the counts.
Parameters: - pos – A single integer or sequence of integers that specify the position of ones to be set.
- size – The total size of the array to be returned.
- counts – The number of times we have observed each index.
- dtype – The element type (compatible with NumPy array()) of the array to be returned.
Returns: An array of length size and element type dtype.
-
nupic.math.stats.
Indicator
(pos, size, dtype)¶ Returns an array of length size and type dtype that is everywhere 0, except in the index in pos.
Parameters: - pos – (int) specifies the position of the one entry that will be set.
- size – (int) The total size of the array to be returned.
- dtype – The element type (compatible with NumPy array()) of the array to be returned.
Returns: (list) of length
size
and element typedtype
.
-
nupic.math.stats.
MultiArgMax
(x)¶ Get tuple (actually a generator) of indices where the max value of array x occurs. Requires that x have a max() method, as x.max() (in the case of NumPy) is much faster than max(x). For a simpler, faster argmax when there is only a single maximum entry, or when knowing only the first index where the maximum occurs, call argmax() on a NumPy array.
Parameters: x – Any sequence that has a max() method. Returns: Generator with the indices where the max value occurs.
-
nupic.math.stats.
MultiIndicator
(pos, size, dtype)¶ Returns an array of length size and type dtype that is everywhere 0, except in the indices listed in sequence pos.
Parameters: - pos – A single integer or sequence of integers that specify the position of ones to be set.
- size – The total size of the array to be returned.
- dtype – The element type (compatible with NumPy array()) of the array to be returned.
Returns: An array of length size and element type dtype.
-
nupic.math.stats.
Product
(sequence)¶ Returns the product of the elements of the sequence. Use numpy.prod() if the sequence is an array, as it will be faster. Remember that the product of many numbers may rapidly overflow or underflow the numeric precision of the computer. Use a sum of the logs of the sequence elements instead when precision should be maintained.
Parameters: sequence – Any sequence whose elements can be multiplied by their neighbors. Returns: A single value that is the product of all the sequence elements.
-
nupic.math.stats.
pickByDistribution
(distribution, r=None)¶ Pick a value according to the provided distribution.
Example:
pickByDistribution([.2, .1])
Returns 0 two thirds of the time and 1 one third of the time.
Parameters: - distribution – Probability distribution. Need not be normalized.
- r – Instance of random.Random. Uses the system instance if one is not provided.
Topology¶
Tools to help with topology.
-
nupic.math.topology.
coordinatesFromIndex
(index, dimensions)¶ Translate an index into coordinates, using the given coordinate system.
Similar to
numpy.unravel_index
.Parameters: index – (int) The index of the point. The coordinates are expressed as a single index by using the dimensions as a mixed radix definition. For example, in dimensions 42x10, the point [1, 4] is index 1*420 + 4*10 = 460. :param dimensions (list of ints) The coordinate system.
Returns: (list) of coordinates of length len(dimensions)
.
-
nupic.math.topology.
indexFromCoordinates
(coordinates, dimensions)¶ Translate coordinates into an index, using the given coordinate system.
Similar to
numpy.ravel_multi_index
.Parameters: - coordinates – (list of ints) A list of coordinates of length
dimensions.size()
. - dimensions – (list of ints) The coordinate system.
Returns: (int) The index of the point. The coordinates are expressed as a single index by using the dimensions as a mixed radix definition. For example, in dimensions 42x10, the point [1, 4] is index 1*420 + 4*10 = 460.
- coordinates – (list of ints) A list of coordinates of length
-
nupic.math.topology.
neighborhood
(centerIndex, radius, dimensions)¶ Get the points in the neighborhood of a point.
A point’s neighborhood is the n-dimensional hypercube with sides ranging [center - radius, center + radius], inclusive. For example, if there are two dimensions and the radius is 3, the neighborhood is 6x6. Neighborhoods are truncated when they are near an edge.
This is designed to be fast. In C++ it’s fastest to iterate through neighbors one by one, calculating them on-demand rather than creating a list of them. But in Python it’s faster to build up the whole list in batch via a few calls to C code rather than calculating them on-demand with lots of calls to Python code.
Parameters: - centerIndex – (int) The index of the point. The coordinates are expressed as a single index by using the dimensions as a mixed radix definition. For example, in dimensions 42x10, the point [1, 4] is index 1*420 + 4*10 = 460.
- radius – (int) The radius of this neighborhood about the
centerIndex
. - dimensions – (indexable sequence) The dimensions of the world outside this neighborhood.
Returns: (numpy array) The points in the neighborhood, including
centerIndex
.
-
nupic.math.topology.
wrappingNeighborhood
(centerIndex, radius, dimensions)¶ Like
neighborhood()
, except that the neighborhood isn’t truncated when it’s near an edge. It wraps around to the other side.Parameters: - centerIndex – (int) The index of the point. The coordinates are expressed as a single index by using the dimensions as a mixed radix definition. For example, in dimensions 42x10, the point [1, 4] is index 1*420 + 4*10 = 460.
- radius – (int) The radius of this neighborhood about the
centerIndex
. - dimensions – (indexable sequence) The dimensions of the world outside this neighborhood.
Returns: (numpy array) The points in the neighborhood, including
centerIndex
.
NuPIC C++ Math Lib¶
A module containing many low-level mathematical data structures and algorithms.
This module is a set of Python bindings for the Numenta C++ math libraries.
Because of this, some calling conventions may more closely reflect the underlying
C++ architecture than a typical Python module.
All classes, functions and constants of nupic.bindings.math
are pre-imported
into nupic.math
, and thus are accessible from nupic.math
.
The module contains the following important and frequently used classes:
nupic.bindings.math.SparseMatrix
SparseTensor
TensorIndex
Domain
-
class
nupic.bindings.math.
DoubleVector
(*args)¶ Proxy of C++ std::vector<(NTA_Real64)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< double >::value_type const &¶
-
begin
(self) → std::vector< double >::iterator¶
-
capacity
(self) → std::vector< double >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< double >::iterator¶
-
erase
(self, pos) → std::vector< double >::iterator¶ erase(self, first, last) -> std::vector< double >::iterator
-
front
(self) → std::vector< double >::value_type const &¶
-
get_allocator
(self) → std::vector< double >::allocator_type¶
-
insert
(self, pos, x) → std::vector< double >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< double >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< double >::reverse_iterator¶
-
rend
(self) → std::vector< double >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< double >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
FloatVector
(*args)¶ Proxy of C++ std::vector<(NTA_Real32)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< float >::value_type const &¶
-
begin
(self) → std::vector< float >::iterator¶
-
capacity
(self) → std::vector< float >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< float >::iterator¶
-
erase
(self, pos) → std::vector< float >::iterator¶ erase(self, first, last) -> std::vector< float >::iterator
-
front
(self) → std::vector< float >::value_type const &¶
-
get_allocator
(self) → std::vector< float >::allocator_type¶
-
insert
(self, pos, x) → std::vector< float >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< float >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< float >::reverse_iterator¶
-
rend
(self) → std::vector< float >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< float >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
nupic.bindings.math.
Gaussian_2D
¶ alias of
_Gaussian2D_32
-
nupic.bindings.math.
GetBasicTypeFromName
(type) → NTA_BasicType¶ GetBasicTypeFromName(typeName) -> int
Internal use. Finds a base type enumeration given a type name.
-
nupic.bindings.math.
GetBasicTypeSize
(type) → size_t¶ GetBasicTypeFromName(typeName) -> int
Internal use. Gets the number of bytes use to specify the named type in C code.
-
nupic.bindings.math.
GetNTAReal
()¶ Gets the numpy dtype of the NuPIC floating point base type, which is used for most internal calculations. The returned value can be used with numpy functions like numpy.array(..., dtype=dtype) and numpy.astype(..., dtype=dtype).
-
nupic.bindings.math.
GetNTARealType
()¶ Gets the name of the NuPIC floating point base type, which is used for most internal calculations. This base type name can be used with GetBasicTypeFromName(), GetBasicTypeSize(), and GetNumpyDataType().
-
nupic.bindings.math.
GetNumpyDataType
(typeName)¶ Gets the numpy dtype associated with a particular NuPIC base type name. The only supported type name is ‘NTA_Real’, which returns a numpy dtype of numpy.float32. The returned value can be used with numpy functions like numpy.array(..., dtype=dtype) and numpy.astype(..., dtype=dtype).
-
nupic.bindings.math.
GetRandomSeed
() → NTA_UInt64¶
-
nupic.bindings.math.
INVARIANT
(cond, msg) → bool¶
-
nupic.bindings.math.
LBP_piPrime
(mat, min_floor=0)¶
-
class
nupic.bindings.math.
LogDiffApprox
(n_=5000000, min_a_=1e-10, max_a_=28, trace_=False)¶ Proxy of C++ nupic::LogDiffApprox class
-
compute_table
(self)¶
-
diff_of_logs
(self, a, b) → nupic::LogDiffApprox::value_type¶
-
fastLogDiff
(self, x, y) → nupic::Real32¶
-
fast_diff_of_logs
(self, a, b) → nupic::LogDiffApprox::value_type¶
-
index
(self, a, b) → int¶
-
logDiff
(self, x, y) → nupic::Real32¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
LogSumApprox
(*args, **kwargs)¶ Proxy of C++ nupic::LogSumApprox class
-
compute_table
(self)¶
-
fastLogSum
(self, x, y) → nupic::Real32¶
-
fast_sum_of_logs
(self, a, b) → nupic::LogSumApprox::value_type¶
-
index
(self, a, b) → int¶
-
logSum
(self, x, y) → nupic::Real32¶
-
sum_of_logs
(self, a, b) → nupic::LogSumApprox::value_type¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
LoggingException
(*args)¶ Proxy of C++ nupic::LoggingException class
-
getMessage
(self) → char const *¶
-
thisown
¶ The membership flag
-
-
nupic.bindings.math.
NN32
¶ alias of
_NearestNeighbor32
-
class
nupic.bindings.math.
PairOfUInt32
(*args)¶ Proxy of C++ std::pair<(nupic::UInt32,nupic::UInt32)> class
-
first
¶ PairOfUInt32_first_get(self) -> unsigned int
-
second
¶ PairOfUInt32_second_get(self) -> unsigned int
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
PairUInt32Real32
(*args)¶ Proxy of C++ std::pair<(nupic::UInt32,nupic::Real32)> class
-
first
¶ PairUInt32Real32_first_get(self) -> unsigned int
-
second
¶ PairUInt32Real32_second_get(self) -> float
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
PairUInt32Real64
(*args)¶ Proxy of C++ std::pair<(nupic::UInt32,nupic::Real64)> class
-
first
¶ PairUInt32Real64_first_get(self) -> unsigned int
-
second
¶ PairUInt32Real64_second_get(self) -> double
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
PyDomain
(*args)¶ Proxy of C++ PyDomain class
-
doesInclude
(self, x) → bool¶
-
getDimensions
(self) → PyTensorIndex¶
-
getLowerBound
(self) → PyTensorIndex¶
-
getNumOpenDims
(self) → nupic::UInt32¶
-
getOpenDimensions
(self) → PyTensorIndex¶
-
getSliceBounds
(self) → PyTensorIndex¶
-
getUpperBound
(self) → PyTensorIndex¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
PySparseTensor
(*args)¶ Proxy of C++ PySparseTensor class
-
addSlice
(self, which, src, dst)¶
-
argmax
(self) → PyTensorIndex¶
-
copy
(self) → PySparseTensor¶
-
extract
(self, dim, ind) → PySparseTensor¶
-
factorAdd
(self, dims, B) → PySparseTensor¶ factorAdd(self, dims, B) -> PySparseTensor
-
factorMultiply
(self, dims, B) → PySparseTensor¶ factorMultiply(self, dims, B) -> PySparseTensor
-
get
(self, i) → nupic::Real¶ get(self, i) -> nupic::Real
-
getBound
(self, dim) → nupic::UInt32¶
-
getBounds
(self) → PyTensorIndex¶
-
getComplementBounds
(self, dims) → PySparseTensor¶
-
getNNonZeros
(self) → nupic::UInt32¶
-
getRank
(self) → nupic::UInt32¶
-
getSlice
(self, range) → PySparseTensor¶
-
innerProduct
(self, dim1, dim2, B) → PySparseTensor¶
-
marginalize
(self) → double¶ marginalize(self, dims) -> PySparseTensor marginalize(self, dims) -> PySparseTensor
-
max
(self) → nupic::Real¶ max(self, dims) -> PySparseTensor max(self, dims) -> PySparseTensor
-
nNonZeros
(self) → nupic::UInt32¶
-
outerProduct
(self, B) → PySparseTensor¶
-
reduce
(self, dim, ind)¶
-
reshape
(self, dims) → PySparseTensor¶
-
resize
(self, dims)¶ resize(self, dims)
-
set
(self, i, x)¶ set(self, i, x) set(self, i, x) set(self, i, x)
-
setSlice
(self, range, slice)¶
-
setZero
(self, range)¶
-
thisown
¶ The membership flag
-
toDense
(self) → PyObject *¶
-
tolist
(self) → PyObject *¶
-
-
class
nupic.bindings.math.
PyTensorIndex
(*args)¶ Proxy of C++ PyTensorIndex class
-
asTuple
(self) → VectorOfUInt32¶
-
begin
(self) → nupic::UInt32 const¶ begin(self) -> nupic::UInt32 *
-
end
(self) → nupic::UInt32 const¶ end(self) -> nupic::UInt32 *
-
size
(self) → nupic::UInt32¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
Random
(*args)¶ Proxy of C++ nupic::Random class
-
getReal64
(self) → nupic::Real64¶
-
getSeed
(self) → nupic::UInt64¶
-
static
getSeeder
() → RandomSeedFuncPtr¶
-
getState
(self) → std::string¶
-
getUInt32
(self, max=MAX32) → nupic::UInt32¶
-
getUInt64
(self, max=MAX64) → nupic::UInt64¶
-
static
initSeeder
(r)¶
-
initializeReal32Array
(self, py_array)¶
-
initializeReal32Array_01
(self, py_array, proba)¶
-
initializeUInt32Array
(self, py_array, max_value)¶
-
jumpAhead
(self, n)¶
-
max
(self) → nupic::Random::result_type¶
-
min
(self) → nupic::Random::result_type¶
-
read
(proto)¶ Initialize the Random instance from the given RandomProto reader.
Parameters: proto – RandomProto message reader containing data from a previously serialized Random instance.
-
sample
(self, population, choices) → PyObject *¶
-
setSeed
(self, x)¶
-
setState
(self, s)¶
-
shuffle
(self, obj) → PyObject *¶
-
static
shutdown
()¶
-
thisown
¶ The membership flag
-
write
(pyBuilder)¶ Serialize the Random instance using capnp.
Param: Destination RandomProto message builder
-
-
nupic.bindings.math.
Random_getSeeder
() → RandomSeedFuncPtr¶
-
nupic.bindings.math.
Random_initSeeder
(r)¶
-
nupic.bindings.math.
Random_shutdown
()¶
-
nupic.bindings.math.
SM32
¶ alias of
_SparseMatrix32
-
nupic.bindings.math.
SM_01_32_32
¶ alias of
_SM_01_32_32
-
nupic.bindings.math.
SM_addConstantOnNonZeros
(A, B, cval)¶
-
nupic.bindings.math.
SM_addToNZAcrossRows
(A, py_x, min_floor=0)¶
-
nupic.bindings.math.
SM_addToNZDownCols
(A, py_x, min_floor=0)¶
-
nupic.bindings.math.
SM_addToNZOnly
(A, v, min_floor=0)¶
-
nupic.bindings.math.
SM_assignNoAlloc
(A, B)¶
-
nupic.bindings.math.
SM_assignNoAllocFromBinary
(A, B)¶
-
nupic.bindings.math.
SM_logAddValNoAlloc
(A, val, min_floor=0)¶
-
nupic.bindings.math.
SM_logDiffNoAlloc
(A, B, min_floor=0)¶
-
nupic.bindings.math.
SM_logSumNoAlloc
(A, B, min_floor=0)¶
-
nupic.bindings.math.
SM_subtractNoAlloc
(A, B, min_floor=0)¶
-
class
nupic.bindings.math.
SegmentSparseMatrix32
(*args, **kwargs)¶ Proxy of C++ nupic::SegmentMatrixAdapter<(nupic::SparseMatrix<(nupic::UInt32,nupic::Real32,nupic::Int32,nupic::Real64,nupic::DistanceToZero<(nupic::Real32)>)>)> class
-
createSegment
(self, cell) → nupic::SegmentMatrixAdapter< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type¶
-
destroySegment
(self, segment)¶
-
matrix
¶ SegmentSparseMatrix32_matrix_get(self) -> _SparseMatrix32
-
nCells
(self) → nupic::SegmentMatrixAdapter< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type¶
-
nSegments
(self) → nupic::SegmentMatrixAdapter< nupic::SparseMatrix< unsigned int,float,int,double,nupic::DistanceToZero< float > > >::size_type¶
-
thisown
¶ The membership flag
-
-
nupic.bindings.math.
SparseMatrix
(*args, **keywords)¶ See help(nupic.bindings.math.SM32).
-
class
nupic.bindings.math.
SparseMatrixAlgorithms
¶ Proxy of C++ nupic::SparseMatrixAlgorithms class
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
SparseMatrixConnections
(*args, **kwargs)¶ Proxy of C++ nupic::SparseMatrixConnections class
-
thisown
¶ The membership flag
-
-
nupic.bindings.math.
SparseTensor
¶ alias of
PySparseTensor
-
class
nupic.bindings.math.
StringIntPair
(*args)¶ Proxy of C++ std::pair<(std::string,NTA_Int32)> class
-
first
¶ StringIntPair_first_get(self) -> std::string const &
-
second
¶ StringIntPair_second_get(self) -> int
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
StringList
(*args)¶ Proxy of C++ std::list<(std::string)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::list< std::string >::value_type const &¶
-
begin
(self) → std::list< std::string >::iterator¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::list< std::string >::iterator¶
-
erase
(self, pos) → std::list< std::string >::iterator¶ erase(self, first, last) -> std::list< std::string >::iterator
-
front
(self) → std::list< std::string >::value_type const &¶
-
get_allocator
(self) → std::list< std::string >::allocator_type¶
-
insert
(self, pos, x) → std::list< std::string >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::list< std::string >::value_type¶
-
pop_back
(self)¶
-
pop_front
(self)¶
-
push_back
(self, x)¶
-
push_front
(self, x)¶
-
rbegin
(self) → std::list< std::string >::reverse_iterator¶
-
rend
(self) → std::list< std::string >::reverse_iterator¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
reverse
(self)¶
-
size
(self) → std::list< std::string >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
StringMap
(*args)¶ Proxy of C++ std::map<(std::string,std::string)> class
-
asdict
(self) → PyObject *¶
-
begin
(self) → std::map< std::string,std::string >::iterator¶
-
clear
(self)¶
-
count
(self, x) → std::map< std::string,std::string >::size_type¶
-
empty
(self) → bool¶
-
end
(self) → std::map< std::string,std::string >::iterator¶
-
erase
(self, x) → std::map< std::string,std::string >::size_type¶ erase(self, position) erase(self, first, last)
-
find
(self, x) → std::map< std::string,std::string >::iterator¶
-
get_allocator
(self) → std::map< std::string,std::string >::allocator_type¶
-
has_key
(self, key) → bool¶
-
items
(self) → PyObject *¶
-
iterator
(self) → SwigPyIterator¶
-
key_iterator
(self) → SwigPyIterator¶
-
keys
(self) → PyObject *¶
-
lower_bound
(self, x) → std::map< std::string,std::string >::iterator¶
-
rbegin
(self) → std::map< std::string,std::string >::reverse_iterator¶
-
rend
(self) → std::map< std::string,std::string >::reverse_iterator¶
-
size
(self) → std::map< std::string,std::string >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
upper_bound
(self, x) → std::map< std::string,std::string >::iterator¶
-
value_iterator
(self) → SwigPyIterator¶
-
values
(self) → PyObject *¶
-
-
class
nupic.bindings.math.
StringMapList
(*args)¶ Proxy of C++ std::vector<(std::map<(std::string,std::string)>)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → StringMap¶
-
begin
(self) → std::vector< std::map< std::string,std::string > >::iterator¶
-
capacity
(self) → std::vector< std::map< std::string,std::string > >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::map< std::string,std::string > >::iterator¶
-
erase
(self, pos) → std::vector< std::map< std::string,std::string > >::iterator¶ erase(self, first, last) -> std::vector< std::map< std::string,std::string > >::iterator
-
front
(self) → StringMap¶
-
get_allocator
(self) → std::vector< std::map< std::string,std::string > >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::map< std::string,std::string > >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → StringMap¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::map< std::string,std::string > >::reverse_iterator¶
-
rend
(self) → std::vector< std::map< std::string,std::string > >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::map< std::string,std::string > >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
StringSet
(*args)¶ Proxy of C++ std::set<(std::string)> class
-
add
(self, x)¶
-
append
(self, x)¶
-
begin
(self) → std::set< std::string >::iterator¶
-
clear
(self)¶
-
count
(self, x) → std::set< std::string >::size_type¶
-
discard
(self, x)¶
-
empty
(self) → bool¶
-
end
(self) → std::set< std::string >::iterator¶
-
equal_range
(self, x) → std::pair< std::set< std::string >::iterator,std::set< std::string >::iterator >¶
-
erase
(self, x) → std::set< std::string >::size_type¶ erase(self, pos) erase(self, first, last)
-
find
(self, x) → std::set< std::string >::iterator¶
-
insert
(self, __x) → std::pair< std::set< std::string >::iterator,bool >¶
-
iterator
(self) → SwigPyIterator¶
-
lower_bound
(self, x) → std::set< std::string >::iterator¶
-
rbegin
(self) → std::set< std::string >::reverse_iterator¶
-
rend
(self) → std::set< std::string >::reverse_iterator¶
-
size
(self) → std::set< std::string >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
upper_bound
(self, x) → std::set< std::string >::iterator¶
-
-
class
nupic.bindings.math.
StringStringList
(*args)¶ Proxy of C++ std::vector<(std::pair<(std::string,std::string)>)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → StringStringPair¶
-
begin
(self) → std::vector< std::pair< std::string,std::string > >::iterator¶
-
capacity
(self) → std::vector< std::pair< std::string,std::string > >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::pair< std::string,std::string > >::iterator¶
-
erase
(self, pos) → std::vector< std::pair< std::string,std::string > >::iterator¶ erase(self, first, last) -> std::vector< std::pair< std::string,std::string > >::iterator
-
front
(self) → StringStringPair¶
-
get_allocator
(self) → std::vector< std::pair< std::string,std::string > >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::pair< std::string,std::string > >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → StringStringPair¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::pair< std::string,std::string > >::reverse_iterator¶
-
rend
(self) → std::vector< std::pair< std::string,std::string > >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::pair< std::string,std::string > >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
StringStringPair
(*args)¶ Proxy of C++ std::pair<(std::string,std::string)> class
-
first
¶ StringStringPair_first_get(self) -> std::string const &
-
second
¶ StringStringPair_second_get(self) -> std::string const &
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
StringVector
(*args)¶ Proxy of C++ std::vector<(std::string)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< std::string >::value_type const &¶
-
begin
(self) → std::vector< std::string >::iterator¶
-
capacity
(self) → std::vector< std::string >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::string >::iterator¶
-
erase
(self, pos) → std::vector< std::string >::iterator¶ erase(self, first, last) -> std::vector< std::string >::iterator
-
front
(self) → std::vector< std::string >::value_type const &¶
-
get_allocator
(self) → std::vector< std::string >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::string >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< std::string >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::string >::reverse_iterator¶
-
rend
(self) → std::vector< std::string >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::string >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
SwigPyIterator
(*args, **kwargs)¶ Proxy of C++ swig::SwigPyIterator class
-
advance
(self, n) → SwigPyIterator¶
-
copy
(self) → SwigPyIterator¶
-
decr
(self, n=1) → SwigPyIterator¶
-
distance
(self, x) → ptrdiff_t¶
-
equal
(self, x) → bool¶
-
incr
(self, n=1) → SwigPyIterator¶
-
next
(self) → PyObject *¶
-
previous
(self) → PyObject *¶
-
thisown
¶ The membership flag
-
value
(self) → PyObject *¶
-
-
nupic.bindings.math.
TensorIndex
¶ alias of
PyTensorIndex
-
class
nupic.bindings.math.
VectorOfInt32
(*args)¶ Proxy of C++ std::vector<(NTA_Int32)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< int >::value_type const &¶
-
begin
(self) → std::vector< int >::iterator¶
-
capacity
(self) → std::vector< int >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< int >::iterator¶
-
erase
(self, pos) → std::vector< int >::iterator¶ erase(self, first, last) -> std::vector< int >::iterator
-
front
(self) → std::vector< int >::value_type const &¶
-
get_allocator
(self) → std::vector< int >::allocator_type¶
-
insert
(self, pos, x) → std::vector< int >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< int >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< int >::reverse_iterator¶
-
rend
(self) → std::vector< int >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< int >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfInt64
(*args)¶ Proxy of C++ std::vector<(NTA_Int64)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< long >::value_type const &¶
-
begin
(self) → std::vector< long >::iterator¶
-
capacity
(self) → std::vector< long >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< long >::iterator¶
-
erase
(self, pos) → std::vector< long >::iterator¶ erase(self, first, last) -> std::vector< long >::iterator
-
front
(self) → std::vector< long >::value_type const &¶
-
get_allocator
(self) → std::vector< long >::allocator_type¶
-
insert
(self, pos, x) → std::vector< long >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< long >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< long >::reverse_iterator¶
-
rend
(self) → std::vector< long >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< long >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfPairsOfUInt32
(*args)¶ Proxy of C++ std::vector<(std::pair<(nupic::UInt32,nupic::UInt32)>)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → PairOfUInt32¶
-
begin
(self) → std::vector< std::pair< unsigned int,unsigned int > >::iterator¶
-
capacity
(self) → std::vector< std::pair< unsigned int,unsigned int > >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::pair< unsigned int,unsigned int > >::iterator¶
-
erase
(self, pos) → std::vector< std::pair< unsigned int,unsigned int > >::iterator¶ erase(self, first, last) -> std::vector< std::pair< unsigned int,unsigned int > >::iterator
-
front
(self) → PairOfUInt32¶
-
get_allocator
(self) → std::vector< std::pair< unsigned int,unsigned int > >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::pair< unsigned int,unsigned int > >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → PairOfUInt32¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::pair< unsigned int,unsigned int > >::reverse_iterator¶
-
rend
(self) → std::vector< std::pair< unsigned int,unsigned int > >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::pair< unsigned int,unsigned int > >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfPairsUInt32Real32
(*args)¶ Proxy of C++ std::vector<(std::pair<(nupic::UInt32,nupic::Real32)>)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → PairUInt32Real32¶
-
begin
(self) → std::vector< std::pair< unsigned int,float > >::iterator¶
-
capacity
(self) → std::vector< std::pair< unsigned int,float > >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::pair< unsigned int,float > >::iterator¶
-
erase
(self, pos) → std::vector< std::pair< unsigned int,float > >::iterator¶ erase(self, first, last) -> std::vector< std::pair< unsigned int,float > >::iterator
-
front
(self) → PairUInt32Real32¶
-
get_allocator
(self) → std::vector< std::pair< unsigned int,float > >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::pair< unsigned int,float > >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → PairUInt32Real32¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::pair< unsigned int,float > >::reverse_iterator¶
-
rend
(self) → std::vector< std::pair< unsigned int,float > >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::pair< unsigned int,float > >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfPairsUInt32Real64
(*args)¶ Proxy of C++ std::vector<(std::pair<(nupic::UInt32,nupic::Real64)>)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → PairUInt32Real64¶
-
begin
(self) → std::vector< std::pair< unsigned int,double > >::iterator¶
-
capacity
(self) → std::vector< std::pair< unsigned int,double > >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::pair< unsigned int,double > >::iterator¶
-
erase
(self, pos) → std::vector< std::pair< unsigned int,double > >::iterator¶ erase(self, first, last) -> std::vector< std::pair< unsigned int,double > >::iterator
-
front
(self) → PairUInt32Real64¶
-
get_allocator
(self) → std::vector< std::pair< unsigned int,double > >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::pair< unsigned int,double > >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → PairUInt32Real64¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::pair< unsigned int,double > >::reverse_iterator¶
-
rend
(self) → std::vector< std::pair< unsigned int,double > >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::pair< unsigned int,double > >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfUInt32
(*args)¶ Proxy of C++ std::vector<(NTA_UInt32)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< unsigned int >::value_type const &¶
-
begin
(self) → std::vector< unsigned int >::iterator¶
-
capacity
(self) → std::vector< unsigned int >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< unsigned int >::iterator¶
-
erase
(self, pos) → std::vector< unsigned int >::iterator¶ erase(self, first, last) -> std::vector< unsigned int >::iterator
-
front
(self) → std::vector< unsigned int >::value_type const &¶
-
get_allocator
(self) → std::vector< unsigned int >::allocator_type¶
-
insert
(self, pos, x) → std::vector< unsigned int >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< unsigned int >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< unsigned int >::reverse_iterator¶
-
rend
(self) → std::vector< unsigned int >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< unsigned int >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfUInt64
(*args)¶ Proxy of C++ std::vector<(NTA_UInt64)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → std::vector< unsigned long >::value_type const &¶
-
begin
(self) → std::vector< unsigned long >::iterator¶
-
capacity
(self) → std::vector< unsigned long >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< unsigned long >::iterator¶
-
erase
(self, pos) → std::vector< unsigned long >::iterator¶ erase(self, first, last) -> std::vector< unsigned long >::iterator
-
front
(self) → std::vector< unsigned long >::value_type const &¶
-
get_allocator
(self) → std::vector< unsigned long >::allocator_type¶
-
insert
(self, pos, x) → std::vector< unsigned long >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → std::vector< unsigned long >::value_type¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< unsigned long >::reverse_iterator¶
-
rend
(self) → std::vector< unsigned long >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< unsigned long >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
class
nupic.bindings.math.
VectorOfVectorsOfPairsOfUInt32
(*args)¶ Proxy of C++ std::vector<(std::vector<(std::pair<(nupic::UInt32,nupic::UInt32)>)>)> class
-
append
(self, x)¶
-
assign
(self, n, x)¶
-
back
(self) → VectorOfPairsOfUInt32¶
-
begin
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator¶
-
capacity
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type¶
-
clear
(self)¶
-
empty
(self) → bool¶
-
end
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator¶
-
erase
(self, pos) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator¶ erase(self, first, last) -> std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator
-
front
(self) → VectorOfPairsOfUInt32¶
-
get_allocator
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::allocator_type¶
-
insert
(self, pos, x) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::iterator¶ insert(self, pos, n, x)
-
iterator
(self) → SwigPyIterator¶
-
pop
(self) → VectorOfPairsOfUInt32¶
-
pop_back
(self)¶
-
push_back
(self, x)¶
-
rbegin
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator¶
-
rend
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::reverse_iterator¶
-
reserve
(self, n)¶
-
resize
(self, new_size)¶ resize(self, new_size, x)
-
size
(self) → std::vector< std::vector< std::pair< unsigned int,unsigned int > > >::size_type¶
-
swap
(self, v)¶
-
thisown
¶ The membership flag
-
-
nupic.bindings.math.
beta
(x, y) → nupic::Real64¶
-
nupic.bindings.math.
binarize_with_threshold
(threshold, py_x) → PyObject *¶
-
nupic.bindings.math.
binomial
(n, k) → double¶
-
nupic.bindings.math.
concatenate
(i1, i2) → PyTensorIndex¶
-
nupic.bindings.math.
count_gt
(py_x, threshold) → nupic::UInt32¶
-
nupic.bindings.math.
count_gte
(py_x, threshold) → nupic::UInt32¶
-
nupic.bindings.math.
count_lt
(py_x, threshold) → nupic::UInt32¶
-
nupic.bindings.math.
dense_vector_sum
(py_x) → nupic::Real32¶
-
nupic.bindings.math.
digamma
(x) → nupic::Real64¶
-
nupic.bindings.math.
emod
(x, m) → int¶
-
nupic.bindings.math.
erf
(x) → nupic::Real64¶
-
nupic.bindings.math.
fact
(n) → double¶
-
nupic.bindings.math.
getGlobalEpsilon
() → nupic::Real¶
-
nupic.bindings.math.
isZero_01
(py_x) → bool¶
-
nupic.bindings.math.
kthroot_product
(sm, segment_size, xIn, threshold) → PyObject *¶
-
nupic.bindings.math.
l2_norm
(py_x) → nupic::Real32¶
-
nupic.bindings.math.
lfact
(n) → double¶
-
nupic.bindings.math.
lgamma
(x) → nupic::Real64¶
-
nupic.bindings.math.
logicalAnd
(py_x, py_y) → PyObject *¶
-
nupic.bindings.math.
logicalAnd2
(py_x, py_y)¶
-
nupic.bindings.math.
matrix_entropy
(sm, s=1.0) → PyObject *¶
-
nupic.bindings.math.
min_score_per_category
(maxCategoryIdx, c_py, d_py) → PyObject *¶
-
nupic.bindings.math.
nNonZeroCols_01
(nrows, ncols, py_x) → nupic::UInt32¶
-
nupic.bindings.math.
nNonZeroRows_01
(nrows, ncols, py_x) → nupic::UInt32¶
-
nupic.bindings.math.
nearlyEqualRange
(py_x, py_y, eps=Epsilon) → bool¶
-
nupic.bindings.math.
nearlyZeroRange
(py_x, eps=Epsilon) → bool¶
-
nupic.bindings.math.
nonZeroColsIndicator_01
(nrows, ncols, py_x) → PyObject *¶
-
nupic.bindings.math.
nonZeroRowsIndicator_01
(nrows, ncols, py_x) → PyObject *¶
-
nupic.bindings.math.
partialArgsort
(k, py_x, py_r, direction=-1)¶
-
nupic.bindings.math.
positiveLearningPartialArgsort
(k, py_x, py_r, rng, real_random=False)¶
-
nupic.bindings.math.
positive_less_than
(py_x, eps=Epsilon) → bool¶
-
nupic.bindings.math.
smoothVecArgMaxProd
(sm, k, xIn) → PyObject *¶
-
nupic.bindings.math.
smoothVecMaxProd
(sm, k, xIn) → PyObject *¶
-
nupic.bindings.math.
sparseRightVecProd
(a, m, n, x) → PyObject *¶
-
nupic.bindings.math.
winnerTakesAll_3
(k, seg_size, py_x) → PyObject *¶