当前位置: 首页 > news >正文

成都网站建设好多钱宁波建设工程学校

成都网站建设好多钱,宁波建设工程学校,中国企业培训网,做学校教务处网站连续干预 在这个示例中#xff0c;我们使用LinearDML模型#xff0c;使用随机森林回归模型来估计因果效应。我们首先模拟数据#xff0c;然后模型#xff0c;并使用方法来effect创建不同干预值下的效应#xff08;Conditional Average Treatment Effect#xff0c;CATE我们使用LinearDML模型使用随机森林回归模型来估计因果效应。我们首先模拟数据然后模型并使用方法来effect创建不同干预值下的效应Conditional Average Treatment EffectCATE。 请注意实际情况中的数据可能更加复杂您可能需要根据您的数据和问题来适当选择的模型和参数。此示例仅供参考您可以根据需要进行修改和扩展。 import numpy as np from econml.dml import LinearDML# 生成示例数据 np.random.seed(123) n_samples 1000 n_features 5 X np.random.normal(size(n_samples, n_features)) T np.random.uniform(low0, high1, sizen_samples) # 连续干预变量 y 2 * X[:, 0] 0.5 * X[:, 1] 3 * T np.random.normal(sizen_samples)# 初始化 LinearDML 模型 est LinearDML(model_yauto, model_tauto, random_state123)# 拟合模型 est.fit(y, T, XX)# 给定特征和连续干预值计算干预效应 X_pred np.random.normal(size(10, n_features)) # 假设有新的数据点 X_pred T_pred0 np.array([0]*10) # 指定的连续干预值 T_pred11 np.array([0.2, 0.4, 0.6, 0.8, 1.0, 0.3, 0.5, 0.7, 0.9, 0.1]) # 指定的连续干预值 T_pred1 np.array([0.2]*10) # 指定的连续干预值 T_pred2 np.array([0.4]*10) # 指定的连续干预值 T_pred3 np.array([0.6]*10) # 指定的连续干预值 T_pred4 np.array([0.8]*10) # 指定的连续干预值# 计算连续干预效应 effect_pred est.effect(XX_pred, T0T_pred0, T1T_pred11)print(预测的连续干预效应, effect_pred)# 计算连续干预效应 effect_pred est.effect(XX_pred, T0T_pred0, T1T_pred1)print(预测的连续干预效应, effect_pred) The R Learner is an approach for estimating flexible non-parametric models of conditional average treatment effects in the setting with no unobserved confounders. The method is based on the idea of Neyman orthogonality and estimates a CATE whose mean squared error is robust to the estimation errors of auxiliary submodels that also need to be estimated from data: the outcome or regression model the treatment or propensity or policy or logging policy model 使用随机实验数据进行双重机器学习DML训练可能会在某些情况下获得更好的效果但并不是绝对的规律。DML方法的性能取决于多个因素包括数据质量、特征选择、模型选择和调参等。 使用随机实验数据进行训练的优势在于实验数据通常可以更好地控制混淆因素从而更准确地估计因果效应。如果实验设计得当并且随机化合理那么通过DML训练的模型可以更好地捕捉因果关系从而获得更准确的效应估计。 然而即使使用随机实验数据DML方法仍然需要考虑一些因素例如样本大小、特征的选择和处理、模型的选择和调参等。在实际应用中没有一种方法可以适用于所有情况。有时随机实验数据可能会受到实验设计的限制或者数据质量可能不足以获得准确的效应估计。 因此使用随机实验数据进行DML训练可能会在某些情况下获得更好的效果但并不是绝对的规律。在应用DML方法时仍然需要根据实际情况进行数据分析、模型选择和验证以确保获得准确和可靠的因果效应估计。 连续干预/label01 import numpy as np from econml.dml import LinearDML import scipy# 生成示例数据 np.random.seed(123) n_samples 1000 n_features 5 X np.random.normal(size(n_samples, n_features)) T np.random.uniform(low0, high1, sizen_samples) # 连续干预变量 #y 2 * X[:, 0] 0.5 * X[:, 1] 3 * T np.random.normal(sizen_samples) y np.random.binomial(1, scipy.special.expit(X[:, 0]))# 初始化 LinearDML 模型 est LinearDML(model_yauto, model_tauto, random_state123)# 拟合模型 est.fit(y, T, XX)# 给定特征和连续干预值计算干预效应 X_pred np.random.normal(size(10, n_features)) # 假设有新的数据点 X_pred T_pred0 np.array([0]*10) # 指定的连续干预值 T_pred11 np.array([0.2, 0.4, 0.6, 0.8, 1.0, 0.3, 0.5, 0.7, 0.9, 0.1]) # 指定的连续干预值 T_pred1 np.array([0.2]*10) # 指定的连续干预值 T_pred2 np.array([0.4]*10) # 指定的连续干预值 T_pred3 np.array([0.6]*10) # 指定的连续干预值 T_pred4 np.array([0.8]*10) # 指定的连续干预值# 计算连续干预效应 effect_pred est.effect(XX_pred, T0T_pred0, T1T_pred11)print(预测的连续干预效应, effect_pred)预测的连续干预效应 [-0.00793674 0.00612109 0.03141778 0.00310806 -0.01635394 -0.019054340.06801354 -0.0126543 -0.04603434 0.00821044] dml原理 Double Machine Learning, DML。 方法首先通过X预测T与真实的T作差得到一个T的残差然后通过X预测Y与真实的Y作差得到一个Y的残差预测模型可以是任何ML模型最后基于T的残差和Y的残差进行因果建模。 原理DML采用了一种残差回归的思想。 优点原理简单容易理解。预测阶段可以使用任意ML模型。 缺点 需要因果效应为线性的假设。 应用场景适用于连续Treatment且因果效应为线性场景   单调性约束 因果推断的开源包中有一些可以进行单调性约束的案例。这些案例通常涉及到因果效应的估计同时加入了单调性约束以确保结果更加合理和可解释。以下是一些开源包以及它们支持单调性约束的案例示例 CausalMLhttps://causalml.readthedocs.io/ CausalML 是一个开源的因果推断工具包支持单调性约束。它提供了一些可以用于处理单调性约束的方法例如 SingleTreatment 类。您可以使用该包来在处理因果效应时添加单调性约束。 econmlhttps://econml.azurewebsites.net/ econml 也是一个用于因果推断的工具包支持单调性约束。它提供了一些工具如 SingleTreePolicyInterpreter 和 SingleTreeCateInterpreter用于解释单一决策树的因果效应并且可以根据用户指定的特征添加单调性约束。 SingleTreeCateInterpreter(_SingleTreeInterpreter):An interpreter for the effect estimated by a CATE estimatorParameters----------include_model_uncertainty : bool, default FalseWhether to include confidence interval information when building asimplified model of the cate model. If set to True, thencate estimator needs to support the const_marginal_ate_inference method.uncertainty_level : double, default 0.05The uncertainty level for the confidence intervals to be constructedand used in the simplified model creation. If valuealphathen a multitask decision tree will be built such that all samplesin a leaf have similar target prediction but also similar alphaconfidence intervals.uncertainty_only_on_leaves : bool, default TrueWhether uncertainty information should be displayed only on leaf nodes.If False, then interpretation can be slightly slower, especially for catemodels that have a computationally expensive inference method.
http://www.hkea.cn/news/14493155/

相关文章:

  • 建设微信网站的流程嘉定网站设计怎么样
  • 九江广安建设网站上海到北京高铁票价多少
  • 网站建设外包网青岛建站开发
  • 皮具网站建设网线制作实验总结
  • 网页设计类网站小米路由wordpress
  • 品牌建设更加百度seo公司电话
  • 软件下载的网站大理公司网站建设
  • 买CAD设计图做的网站推一把网络营销学院
  • 类似聚划算的网站怎么建设百度集团
  • 网站上推广游戏怎么做网站建设资金筹措的方案
  • 润滑油网站怎样做效果更好网站建设佰金手指科捷一
  • 汕头网站制作哪里好浙江网站建设哪家最好
  • 网站建设工作计划艺术字体在线生成器毛笔字
  • 宿州网站建设价格如何查询网站被百度收录
  • 自己可以建设网站卖东西吗诸暨广川建设公司网站
  • 电商加盟的网站建设政务网站建设具体指导意见
  • 用vps刷网站流量要怎么做网站优化要做哪些工作
  • 怎样优化网站自然排名html黑什么主题WordPress
  • 常德 网站建设微商城官网地址
  • 网站域名费用怎么做分录网站所有人
  • php网站是什么各类网站规划
  • 怎么看一个网站什么程序做的html论坛模板
  • 番茄todo社区视频免费看医院网站怎么做优化排名
  • wordpress 仿站vip网站制作企业有哪些公司
  • 怎么免费建立自己网站深圳市营销策划有限公司
  • 移动健康app下载wordpress分类seo标题
  • 电商设计网站哪个好人力资源外包平台
  • 网站的优化从哪里进行wordpress系统怎样下载
  • 建个电子商务网站多少钱来凤县住房和城乡建设厅网站
  • 龙泉市建设局门户网站怎么做优惠卷网站