Skip to content

Commit

Permalink
Fix some doctests and exclude import of version >=0.6.1 of xarray bec…
Browse files Browse the repository at this point in the history
  • Loading branch information
jdehning committed Sep 22, 2020
1 parent 4b2a350 commit dd54a1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pymc4/distributions/multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ class MvNormal(ContinuousDistribution):
matrix.
>>> import numpy as np
>>> import pymc4 as pm
>>> covariance_matrix = np.array([[1., 0.5], [0.5, 2]])
>>> mu = np.zeros(2)
>>> vals = pm.MvNormal('vals', loc=loc, covariance_matrix=covariance_matrix, shape=(5, 2))
>>> vals = pm.MvNormal('vals', loc=mu, covariance_matrix=covariance_matrix, shape=(5, 2))
"""

def __init__(self, name, loc, covariance_matrix, **kwargs):
Expand Down Expand Up @@ -362,10 +363,11 @@ class MvNormalCholesky(ContinuousDistribution):
factor of the full covariance matrix (scale_tril).
>>> import numpy as np
>>> import pymc4 as pm
>>> covariance_matrix = np.array([[1., 0.5], [0.5, 2]])
>>> chol_factor = np.linalg.cholesky(covariance_matrix)
>>> mu = np.zeros(2)
>>> vals = pm.MvNormalCholesky('vals', loc=loc, scale_tril=chol_factor)
>>> vals = pm.MvNormalCholesky('vals', loc=mu, scale_tril=chol_factor)
"""

def __init__(self, name, loc, scale_tril, **kwargs):
Expand Down
3 changes: 2 additions & 1 deletion pymc4/inference/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ def sample(
Nothing special is required but passing the model to ``pm.sample``, the rest configuration is
held by PyMC4.
>>> trace = sample(conditioned)
Notes
-----
Things that are considered to be under discussion are overriding observed variables. The API
for that may look like
>>> new_observed = {"nested_model/n": np.random.randn(10) + 1}
>>> trace = sample(conditioned, observed=new_observed)
This will give a trace with new observed variables. This way is considered to be explicit.
>>> # This will give a trace with new observed variables. This way is considered to be explicit.
"""
# assign sampler is no sampler_type is passed``
sampler_assigned: str = auto_assign_sampler(model, sampler_type)
Expand Down

0 comments on commit dd54a1f

Please sign in to comment.