def test_pickle_inferenceresult(self): Y, T, X, W = TestInference.Y, TestInference.T, TestInference.X, TestInference.W est = DML(model_y=LinearRegression(), model_t=LinearRegression(), model_final=Lasso(alpha=0.1, fit_intercept=False), featurizer=PolynomialFeatures(degree=1, include_bias=False), random_state=123) est.fit(Y, T, X=X, W=W) effect_inf = est.effect_inference(X) s = pickle.dumps(effect_inf)
def test_inference_with_none_stderr(self): Y, T, X, W = TestInference.Y, TestInference.T, TestInference.X, TestInference.W est = DML(model_y=LinearRegression(), model_t=LinearRegression(), model_final=Lasso(alpha=0.1, fit_intercept=False), featurizer=PolynomialFeatures(degree=1, include_bias=False), random_state=123) est.fit(Y, T, X=X, W=W) est.summary() est.coef__inference().summary_frame() est.intercept__inference().summary_frame() est.effect_inference(X).summary_frame() est.effect_inference(X).population_summary() est.const_marginal_effect_inference(X).summary_frame() est.marginal_effect_inference(T, X).summary_frame() est = NonParamDML(model_y=LinearRegression(), model_t=LinearRegression(), model_final=LinearRegression(fit_intercept=False), featurizer=PolynomialFeatures(degree=1, include_bias=False), random_state=123) est.fit(Y, T, X=X, W=W) est.effect_inference(X).summary_frame() est.effect_inference(X).population_summary() est.const_marginal_effect_inference(X).summary_frame() est.marginal_effect_inference(T, X).summary_frame() est = DRLearner(model_regression=LinearRegression(), model_propensity=LogisticRegression(), model_final=LinearRegression()) est.fit(Y, T, X=X, W=W) est.effect_inference(X).summary_frame() est.effect_inference(X).population_summary() est.const_marginal_effect_inference(X).summary_frame() est.marginal_effect_inference(T, X).summary_frame()