diff --git a/pymc/model.py b/pymc/model.py index 20a3f8ba45..ed5a0f0555 100644 --- a/pymc/model.py +++ b/pymc/model.py @@ -465,15 +465,15 @@ def __init__(self, mean=0, sigma=1, name=''): # variables in several ways note, that all variables # will get model's name prefix - # 3) you can create variables with Var method - self.Var('v1', Normal.dist(mu=mean, sigma=sd)) - # this will create variable named like '{prefix::}v1' + # 3) you can create variables with the register_rv method + self.register_rv(Normal.dist(mu=mean, sigma=sigma), 'v1', initval=1) + # this will create variable named like '{name::}v1' # and assign attribute 'v1' to instance created # variable can be accessed with self.v1 or self['v1'] # 4) this syntax will also work as we are in the # context of instance itself, names are given as usual - Normal('v2', mu=mean, sigma=sd) + Normal('v2', mu=mean, sigma=sigma) # something more complex is allowed, too half_cauchy = HalfCauchy('sigma', beta=10, initval=1.) @@ -510,7 +510,6 @@ def __init__(self, mean=0, sigma=1, name=''): CustomModel(mean=2, name='second') # variables inside both scopes will be named like `first::*`, `second::*` - """ if TYPE_CHECKING: