代码拉取完成,页面将自动刷新
同步操作将从 连享会/Python-causalml 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import pytest
from causalml.dataset import simulate_nuisance_and_easy_treatment, simulate_hidden_confounder, simulate_randomized_trial
from causalml.dataset import get_synthetic_preds, get_synthetic_summary, get_synthetic_auuc
from causalml.dataset import get_synthetic_preds_holdout, get_synthetic_summary_holdout
from causalml.inference.meta import LRSRegressor, XGBTRegressor
@pytest.mark.parametrize('synthetic_data_func', [simulate_nuisance_and_easy_treatment,
simulate_hidden_confounder,
simulate_randomized_trial])
def test_get_synthetic_preds(synthetic_data_func):
preds_dict = get_synthetic_preds(synthetic_data_func=synthetic_data_func,
n=1000,
estimators={'S Learner (LR)': LRSRegressor(), 'T Learner (XGB)': XGBTRegressor()})
assert preds_dict['S Learner (LR)'].shape[0] == preds_dict['T Learner (XGB)'].shape[0]
def test_get_synthetic_summary():
summary = get_synthetic_summary(synthetic_data_func=simulate_nuisance_and_easy_treatment,
estimators={'S Learner (LR)': LRSRegressor(), 'T Learner (XGB)': XGBTRegressor()})
print(summary)
def test_get_synthetic_preds_holdout():
preds_train, preds_valid = get_synthetic_preds_holdout(synthetic_data_func=simulate_nuisance_and_easy_treatment,
n=1000,
estimators={'S Learner (LR)': LRSRegressor(),
'T Learner (XGB)': XGBTRegressor()})
assert preds_train['S Learner (LR)'].shape[0] == preds_train['T Learner (XGB)'].shape[0]
assert preds_valid['S Learner (LR)'].shape[0] == preds_valid['T Learner (XGB)'].shape[0]
def test_get_synthetic_summary_holdout():
summary = get_synthetic_summary_holdout(synthetic_data_func=simulate_nuisance_and_easy_treatment)
print(summary)
def test_get_synthetic_auuc():
preds_dict = get_synthetic_preds(synthetic_data_func=simulate_nuisance_and_easy_treatment,
n=1000,
estimators={'S Learner (LR)': LRSRegressor(), 'T Learner (XGB)': XGBTRegressor()})
auuc_df = get_synthetic_auuc(preds_dict, plot=False)
print(auuc_df)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。