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

Predict new groups docs #734

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion bambi/interpret/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ def enforce_dtypes(data: pd.DataFrame, df: pd.DataFrame, except_col=None) -> pd.
observed_dtypes = data.dtypes
for col in df.columns:
if col in observed_dtypes.index and not except_col:
df[col] = df[col].astype(observed_dtypes[col])
if observed_dtypes[col] == "category":
# explicitly converts to category dtype
df[col] = df[col].astype("category")
else:
# casts the original dtype to the new data
df[col] = df[col].astype(observed_dtypes[col])
return df


Expand Down
1 change: 1 addition & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ website:
- notebooks/Strack_RRR_re_analysis.ipynb
- notebooks/shooter_crossed_random_ANOVA.ipynb
- notebooks/t_regression.ipynb
- notebooks/predict_new_groups.ipynb
- section: Generalized linear models
contents:
- notebooks/logistic_regression.ipynb
Expand Down
4 changes: 4 additions & 0 deletions docs/notebooks/gallery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
subtitle: With the Student's T distribution
href: t_regression.ipynb
thumbnail: thumbnails/t_regression.png
- title: Predict new groups
subtitle: With Hierarchical models
href: predict_new_groups.ipynb
thumbnail: thumbnails/predict_new_group.png
- category: Generalized Linear Models
description: ""
tiles:
Expand Down
1,556 changes: 1,556 additions & 0 deletions docs/notebooks/predict_new_groups.ipynb

Large diffs are not rendered by default.

Binary file added docs/notebooks/thumbnails/predict_new_group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading