We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f54823 commit 1770be2Copy full SHA for 1770be2
pymc3/tuning/scaling.py
@@ -138,7 +138,7 @@ def eig_recompose(val, vec):
138
return vec.dot(np.diag(val)).dot(vec.T)
139
140
141
-def trace_cov(trace, vars=None):
+def trace_cov(trace, vars=None, model=None):
142
"""
143
Calculate the flattened covariance matrix using a sample trace
144
@@ -155,9 +155,12 @@ def trace_cov(trace, vars=None):
155
r : array (n,n)
156
covariance matrix
157
158
+ model = modelcontext(model)
159
- if vars is None:
160
- vars = trace.samples.keys
+ if model is not None:
161
+ vars = model.free_RVs
162
+ elif vars is None:
163
+ vars = trace.varnames
164
165
def flat_t(var):
166
x = trace[str(var)]
0 commit comments