22
33from .model import Model
44from .external import InputDataGLM , _SimulatorGLM
5+ from .external import pkg_constants
56
67
78class Simulator (_SimulatorGLM , Model ):
@@ -22,6 +23,38 @@ def __init__(
2223 num_features = num_features
2324 )
2425
26+ def param_bounds (
27+ self ,
28+ dtype
29+ ):
30+ dtype = np .dtype (dtype )
31+ dmin = np .finfo (dtype ).min
32+ dmax = np .finfo (dtype ).max
33+ dtype = dtype .type
34+
35+ sf = dtype (pkg_constants .ACCURACY_MARGIN_RELATIVE_TO_LIMIT )
36+ bounds_min = {
37+ "a_var" : np .nextafter (- dmax , np .inf , dtype = dtype ) / sf ,
38+ "b_var" : np .log (np .nextafter (0 , np .inf , dtype = dtype )) / sf ,
39+ "eta_loc" : np .nextafter (- dmax , np .inf , dtype = dtype ) / sf ,
40+ "eta_scale" : np .log (np .nextafter (0 , np .inf , dtype = dtype )) / sf ,
41+ "mean" : np .nextafter (- dmax , np .inf , dtype = dtype ) / sf ,
42+ "sd" : np .nextafter (0 , np .inf , dtype = dtype ),
43+ "probs" : dtype (0 ),
44+ "log_probs" : np .log (np .nextafter (0 , np .inf , dtype = dtype )),
45+ }
46+ bounds_max = {
47+ "a_var" : np .nextafter (dmax , - np .inf , dtype = dtype ) / sf ,
48+ "b_var" : np .nextafter (np .log (dmax ), - np .inf , dtype = dtype ) / sf ,
49+ "eta_loc" : np .nextafter (dmax , - np .inf , dtype = dtype ) / sf ,
50+ "eta_scale" : np .nextafter (np .log (dmax ), - np .inf , dtype = dtype ) / sf ,
51+ "mean" : np .nextafter (dmax , - np .inf , dtype = dtype ) / sf ,
52+ "sd" : np .nextafter (dmax , - np .inf , dtype = dtype ) / sf ,
53+ "probs" : dtype (1 ),
54+ "log_probs" : dtype (0 ),
55+ }
56+ return bounds_min , bounds_max
57+
2558 def generate_params (
2659 self ,
2760 rand_fn_ave = lambda shape : np .random .uniform (10 , 1000 , shape ),
0 commit comments