How to use the econml.dml._FirstStageWrapper function in econml

To help you get started, we’ve selected a few econml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / EconML / econml / dml.py View on Github external
def __init__(self,
                 model_y, model_t, model_final,
                 featurizer=None,
                 discrete_treatment=False,
                 n_splits=2,
                 random_state=None):

        # TODO: consider whether we need more care around stateful featurizers,
        #       since we clone it and fit separate copies

        super().__init__(model_y=_FirstStageWrapper(model_y, True,
                                                    featurizer, False, discrete_treatment),
                         model_t=_FirstStageWrapper(model_t, False,
                                                    featurizer, False, discrete_treatment),
                         model_final=_FinalWrapper(model_final, False, featurizer, True),
                         discrete_treatment=discrete_treatment,
                         n_splits=n_splits,
                         random_state=random_state)
github microsoft / EconML / econml / dml.py View on Github external
def __init__(self,
                 model_y, model_t, model_final,
                 featurizer=None,
                 discrete_treatment=False,
                 n_splits=2,
                 random_state=None):

        # TODO: consider whether we need more care around stateful featurizers,
        #       since we clone it and fit separate copies

        super().__init__(model_y=_FirstStageWrapper(model_y, True,
                                                    featurizer, False, discrete_treatment),
                         model_t=_FirstStageWrapper(model_t, False,
                                                    featurizer, False, discrete_treatment),
                         model_final=_FinalWrapper(model_final, False, featurizer, True),
                         discrete_treatment=discrete_treatment,
                         n_splits=n_splits,
                         random_state=random_state)
github microsoft / EconML / econml / dml.py View on Github external
fit_cate_intercept=True,
                 linear_first_stages=False,
                 discrete_treatment=False,
                 n_splits=2,
                 random_state=None):

        # TODO: consider whether we need more care around stateful featurizers,
        #       since we clone it and fit separate copies
        if model_t == 'auto':
            if discrete_treatment:
                model_t = LogisticRegressionCV(cv=WeightedStratifiedKFold())
            else:
                model_t = WeightedLassoCVWrapper()
        self.bias_part_of_coef = fit_cate_intercept
        self.fit_cate_intercept = fit_cate_intercept
        super().__init__(model_y=_FirstStageWrapper(model_y, True,
                                                    featurizer, linear_first_stages, discrete_treatment),
                         model_t=_FirstStageWrapper(model_t, False,
                                                    featurizer, linear_first_stages, discrete_treatment),
                         model_final=_FinalWrapper(model_final, fit_cate_intercept, featurizer, False),
                         discrete_treatment=discrete_treatment,
                         n_splits=n_splits,
                         random_state=random_state)
github microsoft / EconML / econml / dml.py View on Github external
discrete_treatment=False,
                 n_splits=2,
                 random_state=None):

        # TODO: consider whether we need more care around stateful featurizers,
        #       since we clone it and fit separate copies
        if model_t == 'auto':
            if discrete_treatment:
                model_t = LogisticRegressionCV(cv=WeightedStratifiedKFold())
            else:
                model_t = WeightedLassoCVWrapper()
        self.bias_part_of_coef = fit_cate_intercept
        self.fit_cate_intercept = fit_cate_intercept
        super().__init__(model_y=_FirstStageWrapper(model_y, True,
                                                    featurizer, linear_first_stages, discrete_treatment),
                         model_t=_FirstStageWrapper(model_t, False,
                                                    featurizer, linear_first_stages, discrete_treatment),
                         model_final=_FinalWrapper(model_final, fit_cate_intercept, featurizer, False),
                         discrete_treatment=discrete_treatment,
                         n_splits=n_splits,
                         random_state=random_state)