-
Notifications
You must be signed in to change notification settings - Fork 41
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 context capture to formula materialisation #770
Conversation
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
… frame adjustments
@s3alfisc I added a unit test. Would you like to add some integration tests too? if so, I'd be happy to have some guidance on where to put those. Thanks! |
Hi @adamvig96 , looking very good so far, thank you! Could you add integration into test_api.py? I guess that testing equality of coefficients and SEs of creating splines via the new capture arg + formulaic vs "by hand" should do the job? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Hi @s3alfisc! I added an integration test, wdyt is this enough? Thanks! :) |
Yes, I think so, thank you! Will review and merge later today. One thing that wasn't clear to me - why is the argument set to 0 be default and set to 2 in the code if no mapping is provided? |
I set it to 0 because it was the default in formulaic, but formulaic always adds one when calling their capture_context function (see this for example). I wanted to avoid that repetition of checking whether we got an int (and the add +1) or a mapping, that's why I created the wrapper function in utils. We should probably set it to 1 by default and adding +1 in our wrapper function, maybe that's more readable? |
Hi @adamvig96 , sorry for the slight delay - I took a look at the formulaic code base and it looks like the |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Hi @s3alfisc, thanks for taking a look! If I understand your proposal correctly, that would mean that we only call the |
I actually just realized that I misunderstood how everything works, and what I suggested above doesn't make sense / work. Sorry! |
By setting the defaults to def feols(context=None):
if context is None:
context = {}
elif isinstance(context, int):
context = capture_context(context) |
pre-commit.ci autofix |
Hi @s3alfisc, I made the context parameter optional in feols and fepois. |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
@all-contributors please add @adamvig96 for code |
I've put up a pull request to add @adamvig96! 🎉 |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Sorry for all the noise @adamvig96 , I promise I will not code in the github browser going forward ... 🤕 |
And merged! Thank you Adam @adamvig96 =) |
@s3alfisc, thanks for the support! 💯 |
Context: #769