Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove auto prior #603

Merged
merged 2 commits into from
Dec 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions bambi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class Model:
``"poisson"``, ``"t"``, and ``"wald"``. Defaults to ``"gaussian"``.
priors : dict
Optional specification of priors for one or more terms. A dictionary where the keys are
the names of terms in the model, "common" or "group_specific" and the values are
instances of class ``Prior`` when ``automatic_priors`` is ``"default"``.
the names of terms in the model, "common," or "group_specific" and the values are
instances of class ``Prior``. If priors are unset, uses automatic priors inspired by
the R rstanarm library.
link : str
The name of the link function to use. Valid names are ``"cloglog"``, ``"identity"``,
``"inverse_squared"``, ``"inverse"``, ``"log"``, ``"logit"``, ``"probit"``, and
Expand All @@ -71,9 +72,6 @@ class Model:
If ``True`` (default), priors are automatically rescaled to the data
(to be weakly informative) any time default priors are used. Note that any priors
explicitly set by the user will always take precedence over default priors.
automatic_priors: str
An optional specification to compute automatic priors. ``"default"`` means to use
a method inspired on the R rstanarm library.
noncentered : bool
If ``True`` (default), uses a non-centered parameterization for normal hyperpriors on
grouped parameters. If ``False``, naive (centered) parameterization is used.
Expand All @@ -96,7 +94,6 @@ def __init__(
potentials=None,
dropna=False,
auto_scale=True,
automatic_priors="default",
noncentered=True,
priors_cor=None,
):
Expand Down Expand Up @@ -141,8 +138,6 @@ def __init__(
else:
priors = deepcopy(priors)

self.automatic_priors = automatic_priors

# Obtain design matrices and related objects.
na_action = "drop" if dropna else "error"
self.formula = formula
Expand Down Expand Up @@ -339,14 +334,7 @@ def _build_priors(self):

# Scale priors if there is at least one term in the model and auto_scale is True
if self.terms and self.auto_scale:
method = self.automatic_priors
if method == "default":
scaler = PriorScaler(self)
else:
raise ValueError(
f"{method} is not a valid method for default priors. Use 'default'."
)
self.scaler = scaler
self.scaler = PriorScaler(self)
self.scaler.scale()

def _set_priors(self, priors=None, common=None, group_specific=None):
Expand Down