5
5
import warnings
6
6
import numpy as np
7
7
from scipy .stats import beta as ss_beta
8
- # from scipy.stats import betabino as ss_betabinom
8
+ # from scipy.stats import betabinom as ss_betabinom
9
9
import matplotlib .pyplot as plt
10
10
11
11
from .. import base
@@ -18,14 +18,14 @@ class GenModel(base.Generative):
18
18
Parameters
19
19
----------
20
20
theta : float, optional
21
- a real number in :math:`[0, 1]`, by default 0.5
21
+ a real number in :math:`[0, 1]`, 0.5 by default.
22
22
h_alpha : float, optional
23
- a positive real number, by default 0.5
23
+ a positive real number, 0.5 by default.
24
24
h_beta : float, optional
25
- a positibe real number, by default 0.5
25
+ a positibe real number, 0.5 by default.
26
26
seed : {None, int}, optional
27
27
A seed to initialize numpy.random.default_rng(),
28
- by default None
28
+ None by default.
29
29
"""
30
30
def __init__ (self ,* ,theta = 0.5 ,h_alpha = 0.5 ,h_beta = 0.5 ,seed = None ):
31
31
self .rng = np .random .default_rng (seed )
@@ -58,9 +58,9 @@ def set_h_params(self,h_alpha=None,h_beta=None):
58
58
Parameters
59
59
----------
60
60
h_alpha : float, optional
61
- a positive real number, bydefault None
61
+ a positive real number, None by default.
62
62
h_beta : float, optional
63
- a positibe real number, bydefault None
63
+ a positibe real number, None by default.
64
64
"""
65
65
if h_alpha is not None :
66
66
self .h_alpha = _check .pos_float (h_alpha ,'h_alpha' ,ParameterFormatError )
@@ -93,7 +93,7 @@ def set_params(self,theta=None):
93
93
Parameters
94
94
----------
95
95
theta : float, optional
96
- a real number :math:`\t heta \in [0, 1]`, by default None .
96
+ a real number :math:`\t heta \in [0, 1]`, None by default.
97
97
"""
98
98
if theta is not None :
99
99
self .theta = _check .float_in_closed01 (theta ,'theta' ,ParameterFormatError )
@@ -150,9 +150,9 @@ def visualize_model(self,sample_size=20,sample_num=5):
150
150
Parameters
151
151
----------
152
152
sample_size : int, optional
153
- A positive integer, by default 20
153
+ A positive integer, 20 by default.
154
154
sample_num : int, optional
155
- A positive integer, by default 5
155
+ A positive integer, 5 by default.
156
156
157
157
Examples
158
158
--------
@@ -195,9 +195,9 @@ class LearnModel(base.Posterior,base.PredictiveMixin):
195
195
Parameters
196
196
----------
197
197
h0_alpha : float, optional
198
- a positive real number, by default 0.5
198
+ a positive real number, 0.5 by default.
199
199
h0_beta : float, optional
200
- a positibe real number, by default 0.5
200
+ a positibe real number, 0.5 by default.
201
201
202
202
Attributes
203
203
----------
@@ -240,9 +240,9 @@ def set_h0_params(self,h0_alpha=None,h0_beta=None):
240
240
Parameters
241
241
----------
242
242
h0_alpha : float, optional
243
- a positive real number, by default None
243
+ a positive real number, None by default.
244
244
h0_beta : float, optionanl
245
- a positibe real number, by default None
245
+ a positibe real number, None by default.
246
246
"""
247
247
if h0_alpha is not None :
248
248
self .h0_alpha = _check .pos_float (h0_alpha ,'h0_alpha' ,ParameterFormatError )
@@ -268,9 +268,9 @@ def set_hn_params(self,hn_alpha,hn_beta):
268
268
Parameters
269
269
----------
270
270
hn_alpha : float, optional
271
- a positive real number, by default None
271
+ a positive real number, None by default.
272
272
hn_beta : float, optional
273
- a positibe real number, by default None
273
+ a positibe real number, None by default.
274
274
"""
275
275
if hn_alpha is not None :
276
276
self .hn_alpha = _check .pos_float (hn_alpha ,'hn_alpha' ,ParameterFormatError )
@@ -315,10 +315,10 @@ def estimate_params(self,loss="squared",dict_out=False):
315
315
Parameters
316
316
----------
317
317
loss : str, optional
318
- Loss function underlying the Bayes risk function, by default \" squared\" .
318
+ Loss function underlying the Bayes risk function, \" squared\" by default .
319
319
This function supports \" squared\" , \" 0-1\" , \" abs\" , and \" KL\" .
320
320
dict_out : bool, optional
321
- If ``True``, output will be a dict, by default ``False``.
321
+ If ``True``, output will be a dict, by ``False`` default .
322
322
323
323
Returns
324
324
-------
@@ -376,7 +376,7 @@ def estimate_interval(self,credibility=0.95):
376
376
Parameters
377
377
----------
378
378
credibility : float, optional
379
- A posterior probability that the interval conitans the paramter, by default 0.95
379
+ A posterior probability that the interval conitans the paramter, 0.95 by default.
380
380
381
381
Returns
382
382
-------
@@ -430,7 +430,7 @@ def make_prediction(self,loss="squared"):
430
430
Parameters
431
431
----------
432
432
loss : str, optional
433
- Loss function underlying the Bayes risk function, by default \" squared\" .
433
+ Loss function underlying the Bayes risk function, \" squared\" by default .
434
434
This function supports \" squared\" , \" 0-1\" , \" abs\" , and \" KL\" .
435
435
436
436
Returns
@@ -462,7 +462,7 @@ def pred_and_update(self,x,loss="squared"):
462
462
x : int
463
463
It must be 0 or 1
464
464
loss : str, optional
465
- Loss function underlying the Bayes risk function, by default \" squared\" .
465
+ Loss function underlying the Bayes risk function, \" squared\" by default .
466
466
This function supports \" squared\" , \" 0-1\" , \" abs\" , and \" KL\" .
467
467
468
468
Returns
0 commit comments