-
Notifications
You must be signed in to change notification settings - Fork 14
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
Overwrite environment deepcopy #83
base: master
Are you sure you want to change the base?
Conversation
Related to #82, overwriting deepcopy enabled to deepcopy a bmb.Model |
Thanks for the PR! Do you have an example or test we could add? |
Yes sure. Here is the test I did. The point is that it should be included in bambinos.bambi (not in formulae) and it needs the version of formulae including the fix.
Thank you for your message |
What happens if you do something like import bambi as bmb
import numpy as np
import pandas as pd
model = bmb.Model(
'y ~ np.log(x)',
data=pd.DataFrame({'x':[i + 1 for i in range(10)], 'y':[2*i+0.1/(1+i) for i in range(10)]})
)
clone_model = deepcopy(model)
clone_trace = clone_model.fit(random_seed=0)
clone_model.predict(clone_trace, data=pd.DataFrame({"x": [1, 2, 3, 4]}) Does the last predict work? edit I'm expecting it to fail. Since the environment in the second model is empty (if I understand correctly what's happening with deepcopy) and then it won't be able to find where |
Indeed you are right, the predict fails in this case. Thank you for your help. The test you previously mentionned work |
Brilliant! Thanks for taking the work to do ti. I'm triggering CI now but I will be checking with more care tomorrow. |
Codecov Report
@@ Coverage Diff @@
## master #83 +/- ##
==========================================
+ Coverage 95.54% 95.55% +0.01%
==========================================
Files 30 30
Lines 3543 3552 +9
==========================================
+ Hits 3385 3394 +9
Misses 158 158
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Great to see the CI is passing! @lt-brs Could you tell me a little more about your use case? I would like to know more about how you're using this. I understand you want to pickle a Bambi model and be able to load it again in the future. But I don't know if you have more use cases in mind. Also, if something you're testing fails, could you let me know, please? I'm quite confident this change is not breaking anything of the existing functionalities (all tests are good). But I don't have enough confidence to assume the new feature is working as expected yet, simply because I don't have them in mind right now. |
No description provided.