Skip to content

Conversation

fverac
Copy link
Collaborator

@fverac fverac commented May 10, 2022

No description provided.

@fverac fverac changed the title initial commit for treatment featurization treatment featurization May 18, 2022
@fverac fverac force-pushed the fverac/treatment_featurization branch 2 times, most recently from 5ee16b8 to 617a0b6 Compare May 25, 2022 15:32
@fverac fverac force-pushed the fverac/treatment_featurization branch from f5ea2fb to 64e9b08 Compare June 16, 2022 17:38
@fverac fverac force-pushed the fverac/treatment_featurization branch from d56d478 to fa2aca6 Compare July 27, 2022 19:21
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. I've reviewed all of the non-test code and it mostly looks good but I've added several small thoughts. I hope to review the tests in a separate pass by the end of the week.

@fverac fverac force-pushed the fverac/treatment_featurization branch 2 times, most recently from 93cb728 to b310fe1 Compare September 28, 2022 15:15
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes look great. I've flagged a few remaining issues.

Comment on lines 641 to 643
if hasattr(self, 'treatment_featurizer') and self._original_treatment_featurizer:
feat_T = self.transformer.transform(T)
jac_T = self.transformer.jac(T)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think this logic will work but it still looks a bit weird to my eye, because we're checking _original_treatment_featurizer for non-None-ness when we really care about is that we can use transformer instead. I guess we can't check that transformer is non-None because it also exists for discrete treatments but we don't want to transform in that case?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think perhaps it would be worth being more explicit and promoting "should we use the treatment featurizer when getting marginal effects" to a first-class concept stored as a flag at the base estimator level because that would make this logic much more clear.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also a bit odd because currently transformer is defined as an attribute on the TransformerMixin class, but you're using it here in LinearCateEstimator, which might not be a TransformerMixin instance. So maybe that attribute should also be moved up to be part of the BaseCateEstimator API itself (since you could in principle have TransformerMixins that aren't LinearCateEstimators or vice versa, but we'd now want the attribute in each place).

Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, as long as applying treatment featurization to multi-column treatments either works or is clearly forbidden; in either case this behavior should be covered by a test.

Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@fverac fverac force-pushed the fverac/treatment_featurization branch from bc57c5c to b7ee18f Compare October 20, 2022 18:11
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just a few minor suggestions.

@fverac fverac marked this pull request as ready for review October 28, 2022 17:07
@fverac fverac merged commit deb564f into main Oct 28, 2022
@fverac fverac deleted the fverac/treatment_featurization branch October 28, 2022 17:15
AnthonyCampbell208 pushed a commit to AnthonyCampbell208/EconML-CS696DS that referenced this pull request Apr 20, 2023
Co-authored-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: AnthonyCampbell208 <78286293+AnthonyCampbell208@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants