| | |
- __builtin__.object
-
- nupic.bindings.math.PySparseTensor
- nupic.bindings.math.PyTensorIndex
- nupic.math.MCMC.MHSampler
- nupic.math.stats.ConditionalProbabilityTable2D
- nupic.bindings.math._Domain32(__builtin__.object)
-
- nupic.bindings.math.PyDomain
class ConditionalProbabilityTable2D(__builtin__.object) |
| |
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 nta::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. |
| |
Methods defined here:
- __init__(self, rowHint=None, ncols=None)
- Constructs a new empty histogram with no rows or columns.
If rowHint is specified, ncols must be specified
(though not vice versa).
If ncols is specified, the number of columns cannot be changed
thereafter.
- clean_outcpd(self)
- 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(self, 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(self, 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).
Returns array of length equal to the number of rows.
Parameters
----------
distribution: Array of length equal to the number of columns.
- inferRowCompat(self, 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.
Returns array of length equal to the number of rows.
Parameters
----------
distribution: Array of length equal to the number of columns.
- inferRowEvidence(self, 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).
Returns array of length equal to the number of rows.
Parameters
----------
distribution: Array of length equal to the number of columns.
- inferRowMaxProd(self, distribution)
- numColumns(self)
- numRows(self)
- Gets the number of rows in the histogram.
Returns Integer number of rows.
- updateRow(self, 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.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
Domain = class PyDomain(_Domain32) |
| |
C++ includes: PySparseTensor.hpp |
| |
- Method resolution order:
- PyDomain
- _Domain32
- __builtin__.object
Methods defined here:
- __getitem__(*args, **kwargs)
- __getitem__(self, i) -> std::vector<(nta::UInt32,std::allocator<(nta::UInt32)>)>
std::vector<nta::UInt32> PyDomain::__getitem__(int i) const
- __init__(self, *args)
- __init__(self, lowerHalfSpace) -> PyDomain
__init__(self, lower, upper) -> PyDomain
PyDomain::PyDomain(const
TIV &lower, const TIV &upper)
- __repr__ = _swig_repr(self)
- __str__(*args, **kwargs)
- __str__(self) -> string
std::string
PyDomain::__str__() const
- doesInclude(*args, **kwargs)
- doesInclude(self, x) -> bool
bool
PyDomain::doesInclude(const TIV &x) const
- getDimensions(*args, **kwargs)
- getDimensions(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getDimensions() const
- getLowerBound(*args, **kwargs)
- getLowerBound(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getLowerBound() const
- getNumOpenDims(*args, **kwargs)
- getNumOpenDims(self) -> UInt32
nta::UInt32
PyDomain::getNumOpenDims() const
- getOpenDimensions(*args, **kwargs)
- getOpenDimensions(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getOpenDimensions() const
- getSliceBounds(*args, **kwargs)
- getSliceBounds(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getSliceBounds() const
- getUpperBound(*args, **kwargs)
- getUpperBound(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getUpperBound() const
Data descriptors defined here:
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_PyDomain>
Methods inherited from _Domain32:
- empty(*args, **kwargs)
- empty(self) -> bool
bool nta::Domain< UInt
>::empty() const
- getNClosedDims(*args, **kwargs)
- getNClosedDims(self) -> unsigned int
UInt nta::Domain<
UInt >::getNClosedDims() const
- getNOpenDims(*args, **kwargs)
- getNOpenDims(self) -> unsigned int
UInt nta::Domain<
UInt >::getNOpenDims() const
- hasClosedDims(*args, **kwargs)
- hasClosedDims(self) -> bool
bool nta::Domain<
UInt >::hasClosedDims() const
- includes(*args, **kwargs)
- includes(self, d) -> bool
bool nta::Domain< UInt
>::includes(const Domain &d) const
Not strict inclusion.
- rank(*args, **kwargs)
- rank(self) -> unsigned int
UInt nta::Domain< UInt
>::rank() const
- size_elts(*args, **kwargs)
- size_elts(self) -> unsigned int
UInt nta::Domain< UInt
>::size_elts() const
Data descriptors inherited from _Domain32:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class MHSampler(__builtin__.object) |
| | |
Methods defined here:
- __getstate__(self)
- __init__(self, logPosteriorFunc, lpArgs=None, lpKeywds=None, seed=124076833)
- __setstate__(self, state)
- getAcceptanceStats(self)
- getBurnin(self)
- getCurrentValues(self)
- getMAPTable(self)
- getMAPs(self)
- getMaximumLikelihoodTable(self)
- getMaximumLikelihoods(self)
- getParameterNames(self)
- getProposalTable(self)
- getSampleTable(self)
- getSamples(self)
- propose(self, currentValues)
- run(self, n, initialParams=None, printIterations=True, output=None, outputInfo=None, proposalOutput=None)
- setProposal(self, key, dist)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
SparseTensor = class PySparseTensor(__builtin__.object) |
| |
C++ includes:
PySparseTensor.hpp |
| |
Methods defined here:
- __add__(*args, **kwargs)
- __add__(self, B) -> PySparseTensor
PySparseTensor
PySparseTensor::__add__(const PySparseTensor &B) const
- __eq__(*args, **kwargs)
- __eq__(self, B) -> bool
bool
PySparseTensor::__eq__(const PySparseTensor &B) const
- __getitem__(self, key)
- __getstate__(*args, **kwargs)
- __getstate__(self) -> string
string
PySparseTensor::__getstate__() const
- __init__(self, *args)
- __init__(self, state) -> PySparseTensor
__init__(self, bounds) -> PySparseTensor
__init__(self, bounds) -> PySparseTensor
__init__(self, dense) -> PySparseTensor
PySparseTensor::PySparseTensor(PyObject *dense)
- __mul__(*args, **kwargs)
- __mul__(self, x) -> PySparseTensor
PySparseTensor
PySparseTensor::__mul__(const nta::Real &x) const
- __ne__(*args, **kwargs)
- __ne__(self, B) -> bool
bool
PySparseTensor::__ne__(const PySparseTensor &B) const
- __neg__(*args, **kwargs)
- __neg__(self) -> PySparseTensor
PySparseTensor
PySparseTensor::__neg__() const
- __repr__ = _swig_repr(self)
- __setitem__(self, key, value)
- __setstate__(self, s)
- __str__(*args, **kwargs)
- __str__(self) -> PyObject
PyObject *
PySparseTensor::__str__() const
- __sub__(*args, **kwargs)
- __sub__(self, B) -> PySparseTensor
PySparseTensor
PySparseTensor::__sub__(const PySparseTensor &B) const
- addSlice(*args, **kwargs)
- addSlice(self, which, src, dst)
void
PySparseTensor::addSlice(nta::UInt32 which, nta::UInt32 src,
nta::UInt32 dst)
- argmax(*args, **kwargs)
- argmax(self) -> PyTensorIndex
PyTensorIndex
PySparseTensor::argmax() const
- copy(*args, **kwargs)
- copy(self) -> PySparseTensor
PySparseTensor
PySparseTensor::copy() const
- extract(*args, **kwargs)
- extract(self, dim, ind) -> PySparseTensor
PySparseTensor
PySparseTensor::extract(nta::UInt32 dim, const TIV &ind) const
- factorAdd(*args)
- factorAdd(self, dims, B) -> PySparseTensor
factorAdd(self, dims, B) -> PySparseTensor
PySparseTensor
PySparseTensor::factorAdd(const PyTensorIndex &dims, const
PySparseTensor &B) const
- factorMultiply(*args)
- factorMultiply(self, dims, B) -> PySparseTensor
factorMultiply(self, dims, B) -> PySparseTensor
PySparseTensor
PySparseTensor::factorMultiply(const PyTensorIndex &dims, const
PySparseTensor &B) const
- get(*args)
- get(self, i) -> Real
get(self, i) -> Real
nta::Real
PySparseTensor::get(const PyTensorIndex &i) const
- getBound(*args, **kwargs)
- getBound(self, dim) -> UInt32
nta::UInt32
PySparseTensor::getBound(const nta::UInt32 dim) const
- getBounds(*args, **kwargs)
- getBounds(self) -> PyTensorIndex
PyTensorIndex
PySparseTensor::getBounds() const
- getComplementBounds(*args, **kwargs)
- getComplementBounds(self, dims) -> PySparseTensor
PySparseTensor PySparseTensor::getComplementBounds(const PyTensorIndex
&dims) const
- getNNonZeros(*args, **kwargs)
- getNNonZeros(self) -> UInt32
nta::UInt32
PySparseTensor::getNNonZeros() const
- getRank(*args, **kwargs)
- getRank(self) -> UInt32
nta::UInt32
PySparseTensor::getRank() const
- getSlice(*args, **kwargs)
- getSlice(self, range) -> PySparseTensor
PySparseTensor
PySparseTensor::getSlice(const PyDomain &range) const
- getSliceWrap(self, key)
- innerProduct(*args, **kwargs)
- innerProduct(self, dim1, dim2, B) -> PySparseTensor
PySparseTensor
PySparseTensor::innerProduct(const nta::UInt32 dim1, const nta::UInt32
dim2, const PySparseTensor &B) const
- marginalize(*args)
- marginalize(self) -> double
marginalize(self, dims) -> PySparseTensor
marginalize(self, dims) -> PySparseTensor
PySparseTensor
PySparseTensor::marginalize(const PyTensorIndex &dims) const
- max(*args)
- max(self) -> Real
max(self, dims) -> PySparseTensor
max(self, dims) -> PySparseTensor
PySparseTensor
PySparseTensor::max(const PyTensorIndex &dims) const
- outerProduct(*args, **kwargs)
- outerProduct(self, B) -> PySparseTensor
PySparseTensor
PySparseTensor::outerProduct(const PySparseTensor &B) const
- reduce(*args, **kwargs)
- reduce(self, dim, ind)
void
PySparseTensor::reduce(nta::UInt32 dim, const TIV &ind)
- reshape(*args, **kwargs)
- reshape(self, dims) -> PySparseTensor
PySparseTensor
PySparseTensor::reshape(const TIV &dims) const
- resize(*args)
- resize(self, dims)
resize(self, dims)
void
PySparseTensor::resize(const PyTensorIndex &dims)
- set(*args)
- set(self, i, x)
set(self, i, x)
set(self, i, x)
set(self, i, x)
void
PySparseTensor::set(const PyTensorIndex &i, PyObject *x)
- setSlice(*args, **kwargs)
- setSlice(self, range, slice)
void
PySparseTensor::setSlice(const PyDomain &range, const PySparseTensor
&slice)
- setSliceWrap(self, key, value)
- setZero(*args, **kwargs)
- setZero(self, range)
void
PySparseTensor::setZero(const PyDomain &range)
- toDense(*args, **kwargs)
- toDense(self) -> PyObject
PyObject *
PySparseTensor::toDense() const
- tolist(*args, **kwargs)
- tolist(self) -> PyObject
PyObject*
PySparseTensor::tolist() const
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_PySparseTensor>
|
TensorIndex = class PyTensorIndex(__builtin__.object) |
| |
C++ includes: PySparseTensor.hpp |
| |
Methods defined here:
- __eq__(*args)
- __eq__(self, j) -> bool
__eq__(self, j) -> bool
bool
PyTensorIndex::__eq__(const TIV &j) const
- __getitem__(*args, **kwargs)
- __getitem__(self, i) -> UInt32
nta::UInt32
PyTensorIndex::__getitem__(int i) const
- __getslice__(*args, **kwargs)
- __getslice__(self, i, j) -> TIV
TIV
PyTensorIndex::__getslice__(int i, int j) const
- __getstate__(*args, **kwargs)
- __getstate__(self) -> TIV
TIV
PyTensorIndex::__getstate__() const
- __gt__(*args, **kwargs)
- __gt__(self, j) -> bool
bool
PyTensorIndex::__gt__(const PyTensorIndex &j) const
- __init__(self, *args)
- __init__(self) -> PyTensorIndex
__init__(self, x) -> PyTensorIndex
__init__(self, i) -> PyTensorIndex
__init__(self, i, j) -> PyTensorIndex
__init__(self, i, j, k) -> PyTensorIndex
__init__(self, i, j, k, l) -> PyTensorIndex
__init__(self, i) -> PyTensorIndex
__init__(self, i1, i2) -> PyTensorIndex
PyTensorIndex::PyTensorIndex(const PyTensorIndex &i1, const
PyTensorIndex &i2)
- __len__(*args, **kwargs)
- __len__(self) -> UInt32
nta::UInt32
PyTensorIndex::__len__() const
- __lt__(*args, **kwargs)
- __lt__(self, j) -> bool
- __ne__(*args)
- __ne__(self, j) -> bool
__ne__(self, j) -> bool
bool
PyTensorIndex::__ne__(const TIV &j) const
- __repr__ = _swig_repr(self)
- __setitem__(*args, **kwargs)
- __setitem__(self, i, d)
void
PyTensorIndex::__setitem__(int i, nta::UInt32 d)
- __setslice__(*args, **kwargs)
- __setslice__(self, i, j, x)
void
PyTensorIndex::__setslice__(int i, int j, const TIV &x)
- __setstate__(self, tup)
- __str__(*args, **kwargs)
- __str__(self) -> string
std::string
PyTensorIndex::__str__() const
- asTuple(*args, **kwargs)
- asTuple(self) -> TIV
TIV
PyTensorIndex::asTuple() const
- begin(*args)
- begin(self) -> UInt32
begin(self) -> UInt32
nta::UInt32*
PyTensorIndex::begin()
- end(*args)
- end(self) -> UInt32
end(self) -> UInt32
nta::UInt32*
PyTensorIndex::end()
- size(*args, **kwargs)
- size(self) -> UInt32
nta::UInt32
PyTensorIndex::size() const
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_PyTensorIndex>
| |