-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Add predict_sklearn method #535
Conversation
Example script of use: import bambi as bmb
import numpy as np
import pandas as pd
rng = np.random.default_rng(0)
size = 2_000
x = rng.normal(size=size)
data = pd.DataFrame(
{
"x": x,
"y": rng.normal(loc=x, size=size)
}
)
bmb_model = bmb.Model("y ~ x", data)
idata = bmb_model.fit()
test_size = 100
test_x = rng.normal(size=test_size)
test_data = pd.DataFrame(
{
"x": test_x,
"y": rng.normal(loc=test_x, size=test_size)
}
)
predictions = bmb_model.predict_sklearn(idata, "y", test_data) |
Thanks for moving this issue so quickly. I would like to add the following.
Apart from that, if it is a method in |
I still think that the best approach is to show how to work with InferenceData and not add new functions/method for this case. And if necessary improve InferenceData. But following this proposal. I agree that having two predict methods is not good design. Having and utility function could work. Maybe something like Yet another option is to add options or arguments to What other point estimates we want? mean and median seems like immediate candidates, but what about other stuff like trimmed mean (or similar)... |
BTW, i think most if not all the friction could be solved by adding a scikitlearn migration guide, or intro to bambi for scikitlearn users. |
Hi @markgoodhead what do you think about my proposal of writing a scikitlearn migration guide? Are you interested in working on it? |
It seems we don't have interest in implementing such a method. It would be nice to have a migration guide for those coming from scikit learn. See #729 |
An example PR for what a predict_sklearn method would look like on the model object (not for merging/review, just for discussion)