@@ -60,6 +60,7 @@ class BayesianEstimator(ModelBuilder):
60
60
61
61
def __init__ (
62
62
self ,
63
+ data : Union [np .ndarray , pd .DataFrame , pd .Series ] = None ,
63
64
model_config : Dict = None ,
64
65
sampler_config : Dict = None ,
65
66
):
@@ -75,16 +76,9 @@ def __init__(
75
76
"""
76
77
if model_config is None :
77
78
model_config = self .default_model_config
78
- self .model_config = model_config
79
-
80
79
if sampler_config is None :
81
80
sampler_config = self .default_sampler_config
82
- self .sampler_config = sampler_config
83
-
84
- self .model = None # Set by build_model
85
- self .output_var = None # Set by build_model
86
- self .idata = None # idata is generated during fitting
87
- self .is_fitted_ = False
81
+ super ().__init__ (data = data , model_config = model_config , sampler_config = sampler_config )
88
82
89
83
@property
90
84
@abstractmethod
@@ -103,16 +97,11 @@ def _validate_data(self, X, y=None):
103
97
return check_array (X , accept_sparse = False )
104
98
105
99
@abstractmethod
106
- def build_model (self ) -> None :
107
- """
108
- Build the PYMC model. The model is built with placeholder data.
109
- Actual data will be set by _data_setter when fitting or evaluating the model.
110
- Data array size can change but number of dimensions must stay the same.
100
+ def build_model (
101
+ model_data : Dict [str , Union [np .ndarray , pd .DataFrame , pd .Series ]] = None ,
102
+ model_config : Dict [str , Union [int , float , Dict ]] = None ,
103
+ ) -> None :
111
104
112
- Returns:
113
- ----------
114
- None
115
- """
116
105
raise NotImplementedError
117
106
118
107
@abstractmethod
@@ -462,7 +451,7 @@ def _data_setter(self, X, y=None):
462
451
pm .set_data ({"y_data" : y .squeeze ()})
463
452
464
453
@classmethod
465
- def create_sample_input (cls , nsamples = 100 ):
454
+ def generate_model_data (cls , nsamples = 100 , data = None ):
466
455
x = np .linspace (start = 0 , stop = 1 , num = nsamples )
467
456
y = 5 * x + 3
468
457
y = y + np .random .normal (0 , 1 , len (x ))
0 commit comments