@@ -228,9 +228,32 @@ def __init__(self, *args, **kwargs):
228
228
super (Flat , self ).__init__ (defaults = ('_default' ,), * args , ** kwargs )
229
229
230
230
def random (self , point = None , size = None ):
231
+ """Raises ValueError as it is not possible to sample from Flat distribution
232
+
233
+ Parameters
234
+ ----------
235
+ point : dict, optional
236
+ size : int, optional
237
+
238
+ Raises
239
+ -------
240
+ ValueError
241
+ """
231
242
raise ValueError ('Cannot sample from Flat distribution' )
232
243
233
244
def logp (self , value ):
245
+ """
246
+ Calculate log-probability of Flat distribution at specified value.
247
+
248
+ Parameters
249
+ ----------
250
+ value : numeric
251
+ Value for which log-probability is calculated.
252
+
253
+ Returns
254
+ -------
255
+ TensorVariable
256
+ """
234
257
return tt .zeros_like (value )
235
258
236
259
def _repr_latex_ (self , name = None , dist = None ):
@@ -246,9 +269,32 @@ def __init__(self, *args, **kwargs):
246
269
super (HalfFlat , self ).__init__ (defaults = ('_default' ,), * args , ** kwargs )
247
270
248
271
def random (self , point = None , size = None ):
272
+ """Raises ValueError as it is not possible to sample from HalfFlat distribution
273
+
274
+ Parameters
275
+ ----------
276
+ point : dict, optional
277
+ size : int, optional
278
+
279
+ Raises
280
+ -------
281
+ ValueError
282
+ """
249
283
raise ValueError ('Cannot sample from HalfFlat distribution' )
250
284
251
285
def logp (self , value ):
286
+ """
287
+ Calculate log-probability of Uniform distribution at specified value.
288
+
289
+ Parameters
290
+ ----------
291
+ value : numeric
292
+ Value for which log-probability is calculated.
293
+
294
+ Returns
295
+ -------
296
+ TensorVariable
297
+ """
252
298
return bound (tt .zeros_like (value ), value > 0 )
253
299
254
300
def _repr_latex_ (self , name = None , dist = None ):
@@ -333,13 +379,41 @@ def __init__(self, mu=0, sd=None, tau=None, **kwargs):
333
379
super (Normal , self ).__init__ (** kwargs )
334
380
335
381
def random (self , point = None , size = None ):
382
+ """
383
+ Draw random values from Normal distribution.
384
+
385
+ Parameters
386
+ ----------
387
+ point : dict, optional
388
+ Dict of variable values on which random values are to be
389
+ conditioned (uses default point if not specified).
390
+ size : int, optional
391
+ Desired size of random sample (returns one sample if not
392
+ specified).
393
+
394
+ Returns
395
+ -------
396
+ array
397
+ """
336
398
mu , tau , _ = draw_values ([self .mu , self .tau , self .sd ],
337
399
point = point , size = size )
338
400
return generate_samples (stats .norm .rvs , loc = mu , scale = tau ** - 0.5 ,
339
401
dist_shape = self .shape ,
340
402
size = size )
341
403
342
404
def logp (self , value ):
405
+ """
406
+ Calculate log-probability of Normal distribution at specified value.
407
+
408
+ Parameters
409
+ ----------
410
+ value : numeric
411
+ Value for which log-probability is calculated.
412
+
413
+ Returns
414
+ -------
415
+ TensorVariable
416
+ """
343
417
sd = self .sd
344
418
tau = self .tau
345
419
mu = self .mu
0 commit comments