-
Notifications
You must be signed in to change notification settings - Fork 715
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
Fixed inference results when cate_feature_names
is not defined
#225
Conversation
e673f40
to
a7b2688
Compare
a7b2688
to
2549a13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. But could you please also add a test that covers the else
branch so that we don't regress this change in the future?
@kbattocchi I thought about that, but for that to work, we need a CATE estimator with linear final stage that will never have |
I think that one fairly straightforward approach would be to create a very simple wrapper like: class NoFtNamesEst:
def __init__(self, cate_est):
self.cate_est = clone(cate_est, safe=False)
def __getattr__(self, name):
if name != 'cate_feature_names`:
return getattr(self.cate_est, name)
else:
return self.__getattribute__(name) and then test that you can get the inference results with either a plain DML estimator or a wrapped one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming the test, but otherwise looks great.
cls.T = np.random.normal(0, 1, size=(cls.n, )) | ||
cls.Y = np.random.normal(0, 1, size=(cls.n, )) | ||
|
||
def test_inference_results(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename to something like test_inference_no_feature_names
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named it this way so we can add more tests under the same method in the future. And this is just one subtest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay; I generally prefer to have a larger number of fine grained tests than a smaller number of broader tests where possible because it makes it quicker to track down the nature of the error when there's a failure, but I don't feel super strongly about it.
No description provided.