Skip to content

Commit bdb0122

Browse files
docstrings update in model_builder.py
1 parent e38da06 commit bdb0122

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

pymc_experimental/model_builder.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,15 @@ def create_sample_input():
131131
>>> 'chains': 1,
132132
>>> 'target_accept': 0.95,
133133
>>> }
134-
>>> return data, model_config, sampler_config
134+
Returns
135+
-------
136+
data : dict
137+
The data we want to train the model on
138+
model_config : dict
139+
A set of parameters for predictor distributions that allow to save and recreate the model
140+
sampler_config : dict
141+
A set of default settings for sampler config, customization of contents of sampler_config allows introducing new settings to the sampler
135142
"""
136-
137143
raise NotImplementedError
138144

139145
@abstractmethod
@@ -148,11 +154,17 @@ def build_model(
148154
149155
Required Parameters
150156
----------
151-
model_data - preformated data that is going to be used in the model.
152-
For efficiency reasons it should contain only the necesary data columns, not entire available
153-
dataset since it's going to be encoded into data used to recreate the model.
154-
model_config - dictionary where keys are strings representing names of parameters of the model, values are
155-
dictionaries of parameters needed for creating model parameters (see example in create_model_input)
157+
model_data : dict
158+
Preformated data that is going to be used in the model. For efficiency reasons it should contain only the necesary data columns,
159+
not entire available dataset since it's going to be encoded into data used to recreate the model.
160+
model_config : dict
161+
Dictionary where keys are strings representing names of parameters of the model, values are dictionaries of parameters
162+
needed for creating model parameters
163+
164+
See Also
165+
--------
166+
create_model_input : Creates all required input for the model builder based on the data given. Shows the examples of data structures on which the specific
167+
inherited version of model builder operates on.
156168
157169
Returns:
158170
----------
@@ -232,10 +244,9 @@ def load(cls, fname: str):
232244

233245
def fit(
234246
self,
247+
data: Dict[str, Union[np.ndarray, pd.DataFrame, pd.Series]] = None,
235248
progressbar: bool = True,
236249
random_seed: RandomState = None,
237-
data: Dict[str, Union[np.ndarray, pd.DataFrame, pd.Series]] = None,
238-
*args: Any,
239250
**kwargs: Any,
240251
) -> az.InferenceData:
241252
"""
@@ -244,8 +255,15 @@ def fit(
244255
245256
Parameter
246257
---------
247-
data : Dictionary of string and either of numpy array, pandas dataframe or pandas Series
248-
It is the data we need to train the model on.
258+
data : dict
259+
Dictionary of string and either of numpy array, pandas dataframe or pandas Series. It is the data we need to train the model on.
260+
progressbar : bool
261+
Specifies whether the fit progressbar should be displayed
262+
random_seed : RandomState
263+
Provides sampler with initial random seed for obtaining reproducible samples
264+
**kwargs : Any
265+
Custom sampler settings can be provided in form of keyword arguments. The recommended way is to add custom settings to sampler_config provided by
266+
create_sample_input, because arguments provided in the form of kwargs will not be saved into the model, therefore will not be available after loading the model
249267
250268
Returns
251269
-------

0 commit comments

Comments
 (0)