@@ -66,6 +66,22 @@ def __init__(self, n, p, *args, **kwargs):
66
66
self .mode = tt .cast (tround (n * p ), self .dtype )
67
67
68
68
def random (self , point = None , size = None ):
69
+ """
70
+ Draw random values from Binomial distribution.
71
+
72
+ Parameters
73
+ ----------
74
+ point : dict, optional
75
+ Dict of variable values on which random values are to be
76
+ conditioned (uses default point if not specified).
77
+ size : int, optional
78
+ Desired size of random sample (returns one sample if not
79
+ specified).
80
+
81
+ Returns
82
+ -------
83
+ array
84
+ """
69
85
n , p = draw_values ([self .n , self .p ], point = point , size = size )
70
86
return generate_samples (stats .binom .rvs , n = n , p = p ,
71
87
dist_shape = self .shape ,
@@ -172,6 +188,22 @@ def _random(self, alpha, beta, n, size=None):
172
188
return samples
173
189
174
190
def random (self , point = None , size = None ):
191
+ """
192
+ Draw random values from BetaBinomial distribution.
193
+
194
+ Parameters
195
+ ----------
196
+ point : dict, optional
197
+ Dict of variable values on which random values are to be
198
+ conditioned (uses default point if not specified).
199
+ size : int, optional
200
+ Desired size of random sample (returns one sample if not
201
+ specified).
202
+
203
+ Returns
204
+ -------
205
+ array
206
+ """
175
207
alpha , beta , n = \
176
208
draw_values ([self .alpha , self .beta , self .n ], point = point , size = size )
177
209
return generate_samples (self ._random , alpha = alpha , beta = beta , n = n ,
@@ -254,6 +286,22 @@ def __init__(self, p=None, logit_p=None, *args, **kwargs):
254
286
self .mode = tt .cast (tround (self .p ), 'int8' )
255
287
256
288
def random (self , point = None , size = None ):
289
+ """
290
+ Draw random values from Bernoulli distribution.
291
+
292
+ Parameters
293
+ ----------
294
+ point : dict, optional
295
+ Dict of variable values on which random values are to be
296
+ conditioned (uses default point if not specified).
297
+ size : int, optional
298
+ Desired size of random sample (returns one sample if not
299
+ specified).
300
+
301
+ Returns
302
+ -------
303
+ array
304
+ """
257
305
p = draw_values ([self .p ], point = point , size = size )[0 ]
258
306
return generate_samples (stats .bernoulli .rvs , p ,
259
307
dist_shape = self .shape ,
@@ -350,6 +398,22 @@ def _random(self, q, beta, size=None):
350
398
return np .ceil (np .power (np .log (1 - p ) / np .log (q ), 1. / beta )) - 1
351
399
352
400
def random (self , point = None , size = None ):
401
+ """
402
+ Draw random values from DiscreteWeibull distribution.
403
+
404
+ Parameters
405
+ ----------
406
+ point : dict, optional
407
+ Dict of variable values on which random values are to be
408
+ conditioned (uses default point if not specified).
409
+ size : int, optional
410
+ Desired size of random sample (returns one sample if not
411
+ specified).
412
+
413
+ Returns
414
+ -------
415
+ array
416
+ """
353
417
q , beta = draw_values ([self .q , self .beta ], point = point , size = size )
354
418
355
419
return generate_samples (self ._random , q , beta ,
@@ -417,6 +481,22 @@ def __init__(self, mu, *args, **kwargs):
417
481
self .mode = intX (tt .floor (mu ))
418
482
419
483
def random (self , point = None , size = None ):
484
+ """
485
+ Draw random values from Poisson distribution.
486
+
487
+ Parameters
488
+ ----------
489
+ point : dict, optional
490
+ Dict of variable values on which random values are to be
491
+ conditioned (uses default point if not specified).
492
+ size : int, optional
493
+ Desired size of random sample (returns one sample if not
494
+ specified).
495
+
496
+ Returns
497
+ -------
498
+ array
499
+ """
420
500
mu = draw_values ([self .mu ], point = point , size = size )[0 ]
421
501
return generate_samples (stats .poisson .rvs , mu ,
422
502
dist_shape = self .shape ,
@@ -497,6 +577,22 @@ def __init__(self, mu, alpha, *args, **kwargs):
497
577
self .mode = intX (tt .floor (mu ))
498
578
499
579
def random (self , point = None , size = None ):
580
+ """
581
+ Draw random values from NegativeBinomial distribution.
582
+
583
+ Parameters
584
+ ----------
585
+ point : dict, optional
586
+ Dict of variable values on which random values are to be
587
+ conditioned (uses default point if not specified).
588
+ size : int, optional
589
+ Desired size of random sample (returns one sample if not
590
+ specified).
591
+
592
+ Returns
593
+ -------
594
+ array
595
+ """
500
596
mu , alpha = draw_values ([self .mu , self .alpha ], point = point , size = size )
501
597
g = generate_samples (stats .gamma .rvs , alpha , scale = mu / alpha ,
502
598
dist_shape = self .shape ,
@@ -571,6 +667,22 @@ def __init__(self, p, *args, **kwargs):
571
667
self .mode = 1
572
668
573
669
def random (self , point = None , size = None ):
670
+ """
671
+ Draw random values from Geometric distribution.
672
+
673
+ Parameters
674
+ ----------
675
+ point : dict, optional
676
+ Dict of variable values on which random values are to be
677
+ conditioned (uses default point if not specified).
678
+ size : int, optional
679
+ Desired size of random sample (returns one sample if not
680
+ specified).
681
+
682
+ Returns
683
+ -------
684
+ array
685
+ """
574
686
p = draw_values ([self .p ], point = point , size = size )[0 ]
575
687
return generate_samples (np .random .geometric , p ,
576
688
dist_shape = self .shape ,
@@ -643,6 +755,22 @@ def _random(self, lower, upper, size=None):
643
755
return samples
644
756
645
757
def random (self , point = None , size = None ):
758
+ """
759
+ Draw random values from DiscreteUniform distribution.
760
+
761
+ Parameters
762
+ ----------
763
+ point : dict, optional
764
+ Dict of variable values on which random values are to be
765
+ conditioned (uses default point if not specified).
766
+ size : int, optional
767
+ Desired size of random sample (returns one sample if not
768
+ specified).
769
+
770
+ Returns
771
+ -------
772
+ array
773
+ """
646
774
lower , upper = draw_values ([self .lower , self .upper ], point = point , size = size )
647
775
return generate_samples (self ._random ,
648
776
lower , upper ,
@@ -717,6 +845,22 @@ def __init__(self, p, *args, **kwargs):
717
845
self .mode = tt .squeeze (self .mode )
718
846
719
847
def random (self , point = None , size = None ):
848
+ """
849
+ Draw random values from Categorical distribution.
850
+
851
+ Parameters
852
+ ----------
853
+ point : dict, optional
854
+ Dict of variable values on which random values are to be
855
+ conditioned (uses default point if not specified).
856
+ size : int, optional
857
+ Desired size of random sample (returns one sample if not
858
+ specified).
859
+
860
+ Returns
861
+ -------
862
+ array
863
+ """
720
864
p , k = draw_values ([self .p , self .k ], point = point , size = size )
721
865
p = p / np .sum (p , axis = - 1 , keepdims = True )
722
866
@@ -770,6 +914,22 @@ def __init__(self, c, *args, **kwargs):
770
914
self .mean = self .median = self .mode = self .c = c = tt .as_tensor_variable (c )
771
915
772
916
def random (self , point = None , size = None ):
917
+ """
918
+ Draw random values from Constant distribution.
919
+
920
+ Parameters
921
+ ----------
922
+ point : dict, optional
923
+ Dict of variable values on which random values are to be
924
+ conditioned (uses default point if not specified).
925
+ size : int, optional
926
+ Desired size of random sample (returns one sample if not
927
+ specified).
928
+
929
+ Returns
930
+ -------
931
+ array
932
+ """
773
933
c = draw_values ([self .c ], point = point , size = size )[0 ]
774
934
dtype = np .array (c ).dtype
775
935
@@ -851,6 +1011,22 @@ def __init__(self, psi, theta, *args, **kwargs):
851
1011
self .mode = self .pois .mode
852
1012
853
1013
def random (self , point = None , size = None ):
1014
+ """
1015
+ Draw random values from ZeroInflatedPoisson distribution.
1016
+
1017
+ Parameters
1018
+ ----------
1019
+ point : dict, optional
1020
+ Dict of variable values on which random values are to be
1021
+ conditioned (uses default point if not specified).
1022
+ size : int, optional
1023
+ Desired size of random sample (returns one sample if not
1024
+ specified).
1025
+
1026
+ Returns
1027
+ -------
1028
+ array
1029
+ """
854
1030
theta , psi = draw_values ([self .theta , self .psi ], point = point , size = size )
855
1031
g = generate_samples (stats .poisson .rvs , theta ,
856
1032
dist_shape = self .shape ,
@@ -944,6 +1120,22 @@ def __init__(self, psi, n, p, *args, **kwargs):
944
1120
self .mode = self .bin .mode
945
1121
946
1122
def random (self , point = None , size = None ):
1123
+ """
1124
+ Draw random values from ZeroInflatedBinomial distribution.
1125
+
1126
+ Parameters
1127
+ ----------
1128
+ point : dict, optional
1129
+ Dict of variable values on which random values are to be
1130
+ conditioned (uses default point if not specified).
1131
+ size : int, optional
1132
+ Desired size of random sample (returns one sample if not
1133
+ specified).
1134
+
1135
+ Returns
1136
+ -------
1137
+ array
1138
+ """
947
1139
n , p , psi = draw_values ([self .n , self .p , self .psi ], point = point , size = size )
948
1140
g = generate_samples (stats .binom .rvs , n , p ,
949
1141
dist_shape = self .shape ,
@@ -1061,6 +1253,22 @@ def __init__(self, psi, mu, alpha, *args, **kwargs):
1061
1253
self .mode = self .nb .mode
1062
1254
1063
1255
def random (self , point = None , size = None ):
1256
+ """
1257
+ Draw random values from ZeroInflatedNegativeBinomial distribution.
1258
+
1259
+ Parameters
1260
+ ----------
1261
+ point : dict, optional
1262
+ Dict of variable values on which random values are to be
1263
+ conditioned (uses default point if not specified).
1264
+ size : int, optional
1265
+ Desired size of random sample (returns one sample if not
1266
+ specified).
1267
+
1268
+ Returns
1269
+ -------
1270
+ array
1271
+ """
1064
1272
mu , alpha , psi = draw_values (
1065
1273
[self .mu , self .alpha , self .psi ], point = point , size = size )
1066
1274
g = generate_samples (stats .gamma .rvs , alpha , scale = mu / alpha ,
0 commit comments