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

Module stats

source code

Classes [hide private]
  BasicStats
A few statistics of a random tensor (RT) are packed as a tuple.
  Stats2e
Statistics of a random tensor (RT) up to 2nd-order are packed as a tuple.
  Stats2m
a total weight
  Stats2
a total weight
Functions [hide private]
 
weighted(w, A)
Compute w[0]*A[0] + w[1]*A[1] + ...
source code
 
weighted_outer(w, A, B=None)
Compute w[0]*outer(A[0],B[0]) + w[1]*outer(A[1],B[1]) + ...
source code
 
sum_outer(A, B=None)
Compute outer(A[0],B[0]) + outer(A[1],B[1]) + ...
source code
 
moment0(data, weights=None)
Return the 0th order (weighted) moment of the data
source code
 
moment1(data, weights=None)
Return the 1st order (weighted) moment of the data
source code
 
moment2(data, weights=None)
Return the 2nd order (weighted) moment of the data
source code
 
moment2e(data, weights=None)
Return the per-element 2nd order (weighted) moment of the data
source code
 
moment11(data1, data2, weights=None)
Return the (1,1)-th order (weighted) cross moment the two data (point1 * point2^T)
source code
 
mean(n, s1)
Get the mean tensor based on 0th and 1st order moments
source code
 
covariance(n, s2, mean)
Get the covariance tensor based on 0th and 2nd order moments and mean
source code
 
stde(n, s2e, mean)
Get the per-element standard deviation tensor based on 0th and per-element 2nd order moments and mean
source code
 
statslist(data, weights=None, masks=None)
Return the (weighted) total weight, mean, and covariance of the data
source code
 
statsliste(data, weights=None, masks=None)
Return the per-element (weighted) total weight, means, and standard deviations of the data
source code
 
correlation(n, s11, mean1, mean2)
Compute the correlation of 2 datasets based on their 0th and (1,1)-th order cross moment and their mean tensors.
source code
Variables [hide private]
  stdnorm = <scipy.stats.distributions.rv_frozen object at 0x03A...
Function Details [hide private]

weighted(w, A)

source code 

Compute w[0]*A[0] + w[1]*A[1] + ... until the end.

Input:

w: a 1D numpy.array A: a multi-dimensional numpy.array

weighted_outer(w, A, B=None)

source code 

Compute w[0]*outer(A[0],B[0]) + w[1]*outer(A[1],B[1]) + ... until the end.

Input:

w: a 1D numpy.array A: a multi-dimensional numpy.array B: a multi-dimensional numpy.array (optional)

sum_outer(A, B=None)

source code 

Compute outer(A[0],B[0]) + outer(A[1],B[1]) + ... until the end.

Input:

A: a multi-dimensional numpy.array B: a multi-dimensional numpy.array (optional)

moment0(data, weights=None)

source code 

Return the 0th order (weighted) moment of the data

Input:

data: a numpy.array weights: an array of weights for the instances [optional]

Output:

0th order moment -- number of (weighted) instances -- equivalent to len(data)

moment1(data, weights=None)

source code 

Return the 1st order (weighted) moment of the data

Input:

data: a numpy.array weights: an array of weights for the instances [optional]

Output:

s1: 1st order (weighted) moment

moment2(data, weights=None)

source code 

Return the 2nd order (weighted) moment of the data

Input:

data: a numpy.array weights: an array of weights for the instances [optional]

Output:

s2: 2nd order (weighted) moment

moment2e(data, weights=None)

source code 

Return the per-element 2nd order (weighted) moment of the data

Input:

data: a numpy.array weights: an array of weights for the instances [optional]

Output:

s2e: per-element 2nd order (weighted) moment

moment11(data1, data2, weights=None)

source code 

Return the (1,1)-th order (weighted) cross moment the two data (point1 * point2^T)

Input:

data1: a numpy.array data2: a numpy.array weights: an array of weights for the instances [optional]

Output:

s11: (1,1)-th order (weighted) cross moment

mean(n, s1)

source code 

Get the mean tensor based on 0th and 1st order moments

Input:

n: 0th order moment s1: 1st order moment

Output:

mean: mean tensor

covariance(n, s2, mean)

source code 

Get the covariance tensor based on 0th and 2nd order moments and mean

Input:

n: 0th order moment s2: 2nd order moment mean: mean tensor -- see mean()

Output:

thecov: covariance tensor

stde(n, s2e, mean)

source code 

Get the per-element standard deviation tensor based on 0th and per-element 2nd order moments and mean

Input:

n: 0th order moment s2e: per-element 2nd order moment -- see moment2e() mean: mean temsor -- see mean()

Output:

stde: per-element stdandard deviation tensor

statslist(data, weights=None, masks=None)

source code 

Return the (weighted) total weight, mean, and covariance of the data

Input:

data: a numpy.array weights: an array of weights for the instances [optional] masks: an array of masks for the instances [optional]

Output:

n: total weight mean: mean tensor thecov: covariance tensor

statsliste(data, weights=None, masks=None)

source code 

Return the per-element (weighted) total weight, means, and standard deviations of the data

Input:

data: a numpy.array weights: an array of weights for the instances [optional] masks: an array of masks for the instances [optional]

Output:

n: total weight mean: mean tensor thestd: standard deviation tensor

correlation(n, s11, mean1, mean2)

source code 

Compute the correlation of 2 datasets based on their 0th and (1,1)-th order cross moment and their mean tensors.

Input:

n: 0th order moment s12: cross moment of the two datasets -- see moment11() mean1: mean tensor of the first dataset -- see mean() mean2: mean tensor of the second dataset -- see mean()

Output:

cor: correlation tensor of the two dataset (point1*point2^T)


Variables Details [hide private]

stdnorm

Value:
norm(0, 1)