Skip to content

Commit

Permalink
add class attributes to model constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengp0 committed Dec 26, 2024
1 parent acb9879 commit b2593bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/regmod/models/binomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,7 @@ def create_binomial_model(data: Data, **kwargs) -> BinomialModel:
if params[0].inv_link.name == "expit":
return CanonicalBinomialModel(data, params=params)
return BinomialModel(data, params=params)


for key in ["param_names", "default_param_specs"]:
setattr(create_binomial_model, key, getattr(BinomialModel, key))
4 changes: 4 additions & 0 deletions src/regmod/models/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,7 @@ def create_gaussian_model(data: Data, **kwargs) -> GaussianModel:
if params[0].inv_link.name == "identity":
return CanonicalGaussianModel(data, params=params)
return GaussianModel(data, params=params)


for key in ["param_names", "default_param_specs"]:
setattr(create_gaussian_model, key, getattr(GaussianModel, key))
4 changes: 4 additions & 0 deletions src/regmod/models/poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,7 @@ def create_poisson_model(data: Data, **kwargs) -> PoissonModel:
if params[0].inv_link.name == "exp":
return CanonicalPoissonModel(data, params=params)
return PoissonModel(data, params=params)


for key in ["param_names", "default_param_specs"]:
setattr(create_poisson_model, key, getattr(PoissonModel, key))

0 comments on commit b2593bc

Please sign in to comment.