19
19
import numpy as np
20
20
import pymc as pm
21
21
import pytensor .tensor as pt
22
- from pymc .logprob .transforms import RVTransform
22
+ from pymc .logprob .transforms import Transform
23
23
24
24
25
25
class ParamCfg (TypedDict ):
26
26
name : str
27
- transform : Optional [RVTransform ]
27
+ transform : Optional [Transform ]
28
28
dims : Optional [Union [str , Tuple [str ]]]
29
29
30
30
@@ -44,14 +44,14 @@ class FlatInfo(TypedDict):
44
44
info : List [VarInfo ]
45
45
46
46
47
- def _arg_to_param_cfg (key , value : Optional [Union [ParamCfg , RVTransform , str , Tuple ]] = None ):
47
+ def _arg_to_param_cfg (key , value : Optional [Union [ParamCfg , Transform , str , Tuple ]] = None ):
48
48
if value is None :
49
49
cfg = ParamCfg (name = key , transform = None , dims = None )
50
50
elif isinstance (value , Tuple ):
51
51
cfg = ParamCfg (name = key , transform = None , dims = value )
52
52
elif isinstance (value , str ):
53
53
cfg = ParamCfg (name = value , transform = None , dims = None )
54
- elif isinstance (value , RVTransform ):
54
+ elif isinstance (value , Transform ):
55
55
cfg = ParamCfg (name = key , transform = value , dims = None )
56
56
else :
57
57
cfg = value .copy ()
@@ -62,7 +62,7 @@ def _arg_to_param_cfg(key, value: Optional[Union[ParamCfg, RVTransform, str, Tup
62
62
63
63
64
64
def _parse_args (
65
- var_names : Sequence [str ], ** kwargs : Union [ParamCfg , RVTransform , str , Tuple ]
65
+ var_names : Sequence [str ], ** kwargs : Union [ParamCfg , Transform , str , Tuple ]
66
66
) -> Dict [str , ParamCfg ]:
67
67
results = dict ()
68
68
for var in var_names :
@@ -133,7 +133,7 @@ def prior_from_idata(
133
133
name = "trace_prior_" ,
134
134
* ,
135
135
var_names : Sequence [str ] = (),
136
- ** kwargs : Union [ParamCfg , RVTransform , str , Tuple ]
136
+ ** kwargs : Union [ParamCfg , Transform , str , Tuple ]
137
137
) -> Dict [str , pt .TensorVariable ]:
138
138
"""
139
139
Create a prior from posterior using MvNormal approximation.
@@ -153,7 +153,7 @@ def prior_from_idata(
153
153
Inference data with posterior group
154
154
var_names: Sequence[str]
155
155
names of variables to take as is from the posterior
156
- kwargs: Union[ParamCfg, RVTransform , str, Tuple]
156
+ kwargs: Union[ParamCfg, Transform , str, Tuple]
157
157
names of variables with additional configuration, see more in Examples
158
158
159
159
Examples
0 commit comments