In [18]:
import cov_utils as mu
In [19]:
import numpy as np
In [20]:
def generateCov(dims, seed=None, low=-0.5, high=0.5):
if seed is not None:
np.random.seed(seed)
x = np.random.uniform(low, high, size=dims)
y = np.random.uniform(low, high,size=dims)
m = np.outer(x, y)
return np.dot(m, m.transpose())
In [21]:
cov = generateCov(dims=3, seed=42)
In [22]:
cov
Out[22]:
In [23]:
Cov = mu.covariance(cov, paramNames=['x0', 'x1', 'x2'])
In [24]:
Cov
Out[24]:
In [26]:
mu.subcovariance(Cov, paramList=['x0', 'x2'])
Out[26]:
In [27]:
Cov.ix[['x0', 'x1'],['x0', 'x1']].values
Out[27]:
In [28]:
dfc = mu.covariance(cov, paramNames=['x0', 'x1', 'x2']); dfc
Out[28]:
In [29]:
Cov
Out[29]:
In [31]:
mu.log_covariance(Cov, 'x0', 55.0)
Out[31]:
In [32]:
isinstance('1', str)
Out[32]:
In [33]:
Cov.iloc[0]
Out[33]:
In [34]:
Cov.values
Out[34]:
In [35]:
Cov.values.diagonal()
Out[35]:
In [ ]: