Skip to content

Commit

Permalink
Merge branch 'main' of github.com:jt-lab/bambi into jt-main
Browse files Browse the repository at this point in the history
  • Loading branch information
tomicapretto committed Oct 3, 2023
2 parents 9272a24 + 1387d44 commit b074ba1
Show file tree
Hide file tree
Showing 7 changed files with 3,288 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bambi/priors/scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def scale_threshold(self):
threshold = self.model.components["threshold"]
if isinstance(threshold, ConstantComponent) and threshold.prior.auto_scale:
response_level_n = len(np.unique(self.response_component.response_term.data))
mu = np.round(np.linspace(-2, 2, num=response_level_n - 1), 2)
mu = np.zeros(response_level_n - 1)
threshold.prior = Prior("Normal", mu=mu, sigma=1)

def scale(self):
Expand Down
2 changes: 2 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ website:
- notebooks/circular_regression.ipynb
- notebooks/quantile_regression.ipynb
- notebooks/mister_p.ipynb
- notebooks/ordinal_regression.ipynb
- notebooks/zero_inflated_regression.ipynb
- section: More advanced models
contents:
- notebooks/distributional_models.ipynb
Expand Down
1,471 changes: 1,471 additions & 0 deletions docs/notebooks/data/hr_employee_attrition.tsv.txt

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion docs/notebooks/gallery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@
- title: Zero inflated models
subtitle: When the outcome is mostly zeros and or is overdispersed
href: zero_inflated_regression.ipynb
thumbnail: thumbnails/zero_inflated_pps.png
thumbnail: thumbnails/zip_model_pps.png
- title: Ordinal regression
subtitle: Model ordered category outcomes
href: ordinal_regression.ipynb
thumbnail: thumbnails/ordinal_regression.png
- category: More advanced models
description: ""
tiles:
Expand Down
1,808 changes: 1,808 additions & 0 deletions docs/notebooks/ordinal_regression.ipynb

Large diffs are not rendered by default.

Binary file added docs/notebooks/thumbnails/ordinal_regression.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/notebooks/zero_inflated_regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@
"\n",
"In this notebook, two classes of models (ZIP and hurdle Poisson) for modeling zero-inflated data were presented and implemented in Bambi. The difference of the data generating process between the two models differ in how zeros are generated. The ZIP model uses a distribution that mixes two data generating processes. The first process generates zeros, and the second process uses a Poisson distribution to generate counts (of which some may be zero). The hurdle Poisson also uses two data generating processes, but doesn't \"mix\" them. A process is used for generating zeros such as a binary model for modeling whether the response variable is zero or not, and a second process for modeling the counts. These two proceses are independent of each other.\n",
"\n",
"The datset used to demonstrate the two models had a large number of zeros. These zeros appeared because the group doesn't fish, or because they fished, but caught zero fish. Because zeros could be generated due to two different reasons, the ZIP model, which allows zeros to be generated from a mixture of processes, seems to be more appropriate for this datset."
"The dataset used to demonstrate the two models had a large number of zeros. These zeros appeared because the group doesn't fish, or because they fished, but caught zero fish. Because zeros could be generated due to two different reasons, the ZIP model, which allows zeros to be generated from a mixture of processes, seems to be more appropriate for this datset."
]
},
{
Expand Down

0 comments on commit b074ba1

Please sign in to comment.