Skip to content

Commit

Permalink
Add comments to the code5
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlheureux committed Aug 15, 2024
1 parent 2038924 commit b775ba8
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions bambi/priors/scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ def scale_intercept(self, term):
if term.prior.name != "Normal":
return
# Special case for logit/probit links with bernoulli or binomial family
if (
isinstance(self.model.family, (Bernoulli, Binomial))
and self.model.family.link["p"].name in ["logit", "probit"]
):
if isinstance(self.model.family, (Bernoulli, Binomial)) and self.model.family.link[
"p"
].name in ["logit", "probit"]:
mu = 0
sigma = 1.5
else:
Expand All @@ -83,10 +82,9 @@ def scale_common(self, term):
if term.data.ndim == 1:
mu = 0
# Special case for logit/probit links with bernoulli or binomial family
if (
isinstance(self.model.family, (Bernoulli, Binomial))
and self.model.family.link["p"].name in ["logit", "probit"]
):
if isinstance(self.model.family, (Bernoulli, Binomial)) and self.model.family.link[
"p"
].name in ["logit", "probit"]:
# For interaction terms, distinguish cases where all factor terms are categorical
if term.kind == "interaction":
all_categoric = all(
Expand All @@ -110,10 +108,9 @@ def scale_common(self, term):
mu = np.zeros(term.data.shape[1])
sigma = np.zeros(term.data.shape[1])
# Special case for logit/probit links with bernoulli or binomial family
if (
isinstance(self.model.family, (Bernoulli, Binomial))
and self.model.family.link["p"].name in ["logit", "probit"]
):
if isinstance(self.model.family, (Bernoulli, Binomial)) and self.model.family.link[
"p"
].name in ["logit", "probit"]:
# Iterate over columns in the data
for i, value in enumerate(term.data.T):
if term.kind == "interaction":
Expand Down

0 comments on commit b775ba8

Please sign in to comment.