@@ -134,7 +134,8 @@ def circ_cont_transform(op):
134
134
class BoundedContinuous (Continuous ):
135
135
"""Base class for bounded continuous distributions"""
136
136
137
- transform_args = None
137
+ # Indices of the arguments that define the lower and upper bounds of the distribution
138
+ bound_args_indices = None
138
139
139
140
def __new__ (cls , * args , ** kwargs ):
140
141
transform = kwargs .get ("transform" , UNSET )
@@ -144,13 +145,15 @@ def __new__(cls, *args, **kwargs):
144
145
145
146
@classmethod
146
147
def default_transform (cls ):
147
- if cls .transform_args is None :
148
- raise ValueError (f"Must specify transform args for { cls .__name__ } bounded distribution" )
148
+ if cls .bound_args_indices is None :
149
+ raise ValueError (
150
+ f"Must specify bound_args_indices for { cls .__name__ } bounded distribution"
151
+ )
149
152
150
153
def transform_params (rv_var ):
151
154
_ , _ , _ , * args = rv_var .owner .inputs
152
- lower = args [cls .transform_args [0 ]]
153
- upper = args [cls .transform_args [1 ]]
155
+ lower = args [cls .bound_args_indices [0 ]]
156
+ upper = args [cls .bound_args_indices [1 ]]
154
157
lower = at .as_tensor_variable (lower ) if lower is not None else None
155
158
upper = at .as_tensor_variable (upper ) if upper is not None else None
156
159
return lower , upper
@@ -244,7 +247,7 @@ class Uniform(BoundedContinuous):
244
247
Upper limit.
245
248
"""
246
249
rv_op = uniform
247
- transform_args = [ 0 , 1 ] # Lower, Upper
250
+ bound_args_indices = ( 0 , 1 ) # Lower, Upper
248
251
249
252
@classmethod
250
253
def dist (cls , lower = 0 , upper = 1 , ** kwargs ):
@@ -3339,7 +3342,7 @@ class Triangular(BoundedContinuous):
3339
3342
"""
3340
3343
3341
3344
rv_op = triangular
3342
- transform_args = [ 0 , 2 ] # lower, upper
3345
+ bound_args_indices = ( 0 , 2 ) # lower, upper
3343
3346
3344
3347
@classmethod
3345
3348
def dist (cls , lower = 0 , upper = 1 , c = 0.5 , * args , ** kwargs ):
0 commit comments