Package pycv :: Package cs :: Package stats :: Module stats :: Class BasicStats
[hide private]
[frames] | no frames]

Class BasicStats

source code

Known Subclasses:
Stats2, Stats2e, Stats2m


A few statistics of a random tensor (RT) are packed as a tuple.
This class represents the collection of some statistics of J RTs.
The class contains a few variables:
    J: the number of RTs
    shape: the shape represents of how the dimensions of an RT are organized
    d: the number of dimensions of an RT
    orders: an array of statistic orders
    A: the numpy.array (tensor) representing the whole data



Instance Methods [hide private]
 
__init__(self, J, shape, orders, A=None)
Initialize BasicStats with J, shape, orders, and optionally A.
source code
 
get_indices(self, i)
Get the indices of the i-th type of statistics.
source code
 
get_stat(self, i)
Get the tensor of statistics of the i-th type.
source code
 
get_cond_stat(self, j, i)
Get the class-conditional tensor of statistics of the ith-type.
source code
 
set_cond_stat(self, j, i, A)
Set the class-conditional tensor of statistics of the ith-type.
source code
 
_new_dA(self, new_shape, new_A)
This function is to be virtuallized and used internally only.
source code
 
take(self, indices)
Flatten the shape of the RTs, then take only dimensions indexed in 'indices' and remove the remaining dimensions.
source code
Method Details [hide private]

get_indices(self, i)

source code 

Get the indices of the i-th type of statistics.

Input:
i: the index
Output:
(istart,iend): the indices

get_stat(self, i)

source code 

Get the tensor of statistics of the i-th type.

Input:
i: the index
Output:
A: the tensor of statistics of the i-th type with shape (J,)+shape^rank[i]

get_cond_stat(self, j, i)

source code 

Get the class-conditional tensor of statistics of the ith-type.

Input:
j: the index i: the class
Output:
A: the class-conditional tensor of statistics of the i-th type
of shape shape^rank[i]

set_cond_stat(self, j, i, A)

source code 
Set the class-conditional tensor of statistics of the ith-type.

Input:
    j: the index
    i: the class
    A: the class-conditional tensor of statistics of the i-th type
        of shape shape^rank[i]

_new_dA(self, new_shape, new_A)

source code 
This function is to be virtuallized and used internally only. To create a copy of this 'self' with new 'shape' and new 'A'.

take(self, indices)

source code 

Flatten the shape of the RTs, then take only dimensions indexed in 'indices' and remove the remaining dimensions.

Input:
indices: a numpy.array of dimensions to be kept.
Output:
B: the BasicStats obtained from the remaining dimensions.