Skip to content

Commit 6f67dec

Browse files
michaelraczyckiMichal Raczycki
and
Michal Raczycki
authored
changed id of model_builder to property, added type hinting (#110)
Co-authored-by: Michal Raczycki <[email protected]>
1 parent 2d9e514 commit 6f67dec

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pymc_experimental/model_builder.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def load(cls, fname):
192192
idata.fit_data.to_dataframe(),
193193
)
194194
self.idata = idata
195-
if self.id() != idata.attrs["id"]:
195+
if self.id != idata.attrs["id"]:
196196
raise ValueError(
197197
f"The file '{fname}' does not contain an inference data of the same model or configuration as '{self._model_type}'"
198198
)
@@ -234,7 +234,7 @@ def fit(self, data: Dict[str, Union[np.ndarray, pd.DataFrame, pd.Series]] = None
234234
self.idata.extend(pm.sample_prior_predictive())
235235
self.idata.extend(pm.sample_posterior_predictive(self.idata))
236236

237-
self.idata.attrs["id"] = self.id()
237+
self.idata.attrs["id"] = self.id
238238
self.idata.attrs["model_type"] = self._model_type
239239
self.idata.attrs["version"] = self.version
240240
self.idata.attrs["sample_config_keys"] = tuple(self.sample_config.keys())
@@ -344,7 +344,8 @@ def _extract_samples(post_pred: az.data.inference_data.InferenceData) -> Dict[st
344344

345345
return post_pred_dict
346346

347-
def id(self):
347+
@property
348+
def id(self) -> str:
348349
"""
349350
It creates a hash value to match the model version using last 16 characters of hash encoding.
350351

0 commit comments

Comments
 (0)