[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-py-why--dowhy":3,"tool-py-why--dowhy":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",150720,2,"2026-04-11T11:33:10",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":76,"owner_website":77,"owner_url":78,"languages":79,"stars":84,"forks":85,"last_commit_at":86,"license":87,"difficulty_score":32,"env_os":88,"env_gpu":89,"env_ram":89,"env_deps":90,"category_tags":99,"github_topics":101,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":113,"updated_at":114,"faqs":115,"releases":145},6650,"py-why\u002Fdowhy","dowhy","DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks. ","DoWhy 是一款专为因果推断设计的 Python 开源库，旨在帮助开发者从数据中挖掘变量间的真实因果关系，而不仅仅是识别相关性。在现实决策中，我们常需回答“如果采取某项行动，结果会如何变化”或“是什么导致了当前现象”等问题，传统预测模型往往难以胜任，而 DoWhy 正是为了解决这一痛点而生。\n\n它适合数据科学家、研究人员以及需要基于数据进行严谨决策的工程师使用。无论是评估营销活动的实际效果、分析用户流失的根本原因，还是诊断微服务架构中的延迟问题，DoWhy 都能提供系统化的支持。其核心亮点在于将因果图模型与潜在结果框架统一到一个简洁的接口中，引导用户完成建模、推断、验证的全过程。特别值得一提的是，DoWhy 内置了强大的“反驳测试”（Refutation）功能，能够自动检验因果假设的稳健性，有效防止错误结论，让非专家用户也能放心使用。作为 PyWhy 生态的重要组成部分，DoWhy 通过丰富的案例笔记和活跃的社区支持，让复杂的因果分析变得直观且可操作。","|BuildStatus|_ |PyPiVersion|_ |PythonSupport|_ |Downloads|_ |discord|_ |gurubase|_\n\n.. |PyPiVersion| image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdowhy.svg\n.. _PyPiVersion: https:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F\n\n.. |PythonSupport| image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fdowhy.svg\n.. _PythonSupport: https:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F\n\n.. |BuildStatus| image:: https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg\n.. _BuildStatus: https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Factions\n\n.. |Downloads| image:: https:\u002F\u002Fpepy.tech\u002Fbadge\u002Fdowhy\n.. _Downloads: https:\u002F\u002Fpepy.tech\u002Fproject\u002Fdowhy\n\n.. |discord| image:: https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F818456847551168542\n.. _discord: https:\u002F\u002Fdiscord.gg\u002FcSBGb3vsZb\n\n.. |gurubase| image:: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGurubase-Ask%20DoWhy%20Guru-006BFF\n.. _gurubase: https:\u002F\u002Fgurubase.io\u002Fg\u002Fdowhy\n\n.. image:: dowhy-logo-large.png\n  :width: 50%\n  :align: center\n\n\n`Checkout the documentation \u003Chttps:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F>`_\n===============================================================\n\n- The documentation, user guide, sample notebooks and other information are available at\n    `https:\u002F\u002Fpy-why.github.io\u002Fdowhy \u003Chttps:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F>`_\n- DoWhy is part of the `PyWhy Ecosystem \u003Chttps:\u002F\u002Fwww.pywhy.org\u002F>`_. For more tools and libraries related to causality, checkout the `PyWhy GitHub organization \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002F>`_!\n- For any questions, comments, or discussions about specific use cases, join our community on `Discord \u003Chttps:\u002F\u002Fdiscord.gg\u002FcSBGb3vsZb>`_ (|discord|_)\n- Jump right into some case studies:\n    - Effect estimation: `Hotel booking cancellations \u003Chttps:\u002F\u002Fmedium.com\u002Fdata-science\u002Fbeyond-predictive-models-the-causal-story-behind-hotel-booking-cancellations-d29e8558cbaf>`_ | `Effect of customer loyalty programs \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fdowhy_example_effect_of_memberrewards_program.html>`_ | `Optimizing article headlines \u003Chttps:\u002F\u002Fmedium.com\u002F@akelleh\u002Fintroducing-the-do-sampler-for-causal-inference-a3296ea9e78d>`_ | `Effect of home visits on infant health (IHDP) \u003Chttps:\u002F\u002Fmedium.com\u002Fdata-science\u002Fimplementing-causal-inference-a-key-step-towards-agi-de2cde8ea599>`_ | `Causes of customer churn\u002Fattrition \u003Chttps:\u002F\u002Fmedium.com\u002Fgeekculture\u002Fa-quickstart-for-causal-analysis-decision-making-with-dowhy-2ce2d4d1efa9>`_\n    - Root cause analysis and explanations: `Causal attribution and root-cause analysis of an online shop \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_online_shop.html>`_ | `Finding the Root Cause of Elevated Latencies in a Microservice Architecture \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_rca_microservice_architecture.html>`_ | `Finding Root Causes of Changes in a Supply Chain \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_supply_chain_dist_change.html>`_\n\nFor more example notebooks, see `here! \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fnb_index.html>`_\n\nIntroduction & Key Features\n===========================\nDecision-making involves understanding how different variables affect each other and predicting the outcome when some of them are changed to new values. For instance, given an outcome variable, one may be interested in determining how a potential action(s) may affect it, understanding what led to its current value, or simulate what would happen if some variables are changed. Answering such questions requires causal reasoning. DoWhy is a Python library that guides you through the various steps of causal reasoning and provides a unified interface for answering causal questions.\n\nDoWhy provides a wide variety of algorithms for effect estimation, prediction, quantification\nof causal influences, diagnosis of causal structures, root cause analysis, interventions and\ncounterfactuals. A key feature of DoWhy is its refutation and falsification API that can test causal assumptions for any estimation method,\nthus making inference more robust and accessible to non-experts.\n\n**Graphical Causal Models and Potential Outcomes: Best of both worlds**\n\nDoWhy builds on two of the most powerful frameworks for causal inference:\ngraphical causal models and potential outcomes. For effect estimation, it uses graph-based criteria and do-calculus for\nmodeling assumptions and identifying a non-parametric causal effect. For estimation, it switches to methods based\nprimarily on potential outcomes.\n\nFor causal questions beyond effect estimation, it uses the power of graphical causal models by modeling the data\ngeneration process via explicit causal mechanisms at each node, which, for instance, unlocks capabilities to attribute\nobserved effects to particular variables or estimate point-wise counterfactuals.\n\nFor a quick introduction to causal inference, check out `amit-sharma\u002Fcausal-inference-tutorial \u003Chttps:\u002F\u002Fgithub.com\u002Famit-sharma\u002Fcausal-inference-tutorial\u002F>`_\nWe also gave a more comprehensive tutorial at the ACM Knowledge Discovery and Data Mining (`KDD 2018 \u003Chttp:\u002F\u002Fwww.kdd.org\u002Fkdd2018\u002F>`_) conference: `causalinference.gitlab.io\u002Fkdd-tutorial \u003Chttp:\u002F\u002Fcausalinference.gitlab.io\u002Fkdd-tutorial\u002F>`_.\nFor an introduction to the four steps of causal inference and its implications for machine learning, you can access this video tutorial from Microsoft Research `DoWhy Webinar \u003Chttps:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fvideo\u002Ffoundations-of-causal-inference-and-its-impacts-on-machine-learning\u002F>`_ and for an introduction to the graphical causal model API, see the `PyCon presentation on Root Cause Analysis with DoWhy \u003Chttps:\u002F\u002Fwww.youtube.com\u002Fwatch?v=icpHrbDlGaw>`_.\n\nKey Features\n~~~~~~~~~~~~\n\n.. image:: https:\u002F\u002Fraw.githubusercontent.com\u002Fpy-why\u002Fdowhy\u002Fmain\u002Fdocs\u002Fimages\u002Fdowhy-features.png\n\nDoWhy supports the following causal tasks:\n\n- Effect estimation (identification, average causal effect, conditional average causal effect, instrumental variables and more)\n- Quantify causal influences (mediation analysis, direct arrow strength, intrinsic causal influence)\n- What-if analysis (generate samples from interventional distribution, estimate counterfactuals)\n- Root cause analysis and explanations (attribute anomalies to their causes, find causes for changes in distributions, estimate feature relevance and more)\n\nFor more details and how to use these methods in practice, checkout the documentation at `https:\u002F\u002Fpy-why.github.io\u002Fdowhy \u003Chttps:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F>`_\n\nQuick Start\n===========\nDoWhy support Python 3.8+. To install, you can use pip, poetry, or conda.\n\n**Latest Release**\n\nInstall the latest `release \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F>`__ using pip.\n\n.. code:: shell\n\n   pip install dowhy\n\nInstall the latest `release \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F>`__ using poetry.\n\n.. code:: shell\n\n   poetry add dowhy\n\nInstall the latest `release \u003Chttps:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fdowhy>`__ using conda.\n\n.. code:: shell\n\n   conda install -c conda-forge dowhy\n\nIf you face \"Solving environment\" problems with conda, then try :code:`conda update --all` and then install dowhy. If that does not work, then use :code:`conda config --set channel_priority false` and try to install again. If the problem persists, please `add your issue here \u003Chttps:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fissues\u002F197>`_.\n\n**Development Version**\n\nIf you prefer to use the latest dev version, your dependency management tool will need to point at our GitHub repository.\n\n.. code:: shell\n\n    pip install git+https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy@main\n\n\n**Requirements**\n\nDoWhy requires a few dependencies. \nDetails on specific versions can be found in `pyproject.toml \u003C.\u002Fpyproject.toml>`_, under the `tool.poetry.dependencies` section.\n\nIf you face any problems, try installing dependencies manually.\n\n.. code:: shell\n\n    pip install '\u003Cdependency-name>==\u003Cversion>'\n\nOptionally, if you wish to input graphs in the dot format, then install pydot (or pygraphviz).\n\nFor better-looking graphs, you can optionally install pygraphviz. To proceed,\nfirst install graphviz and then pygraphviz (on Ubuntu and Ubuntu WSL).\n\n.. note::\n    Installing pygraphviz can cause problems on some platforms.\n    One way that works for most Linux distributions is to\n    first install graphviz and then pygraphviz as shown below.\n    Otherwise, please consult the documentation of `pygraphviz \u003Chttps:\u002F\u002Fpygraphviz.github.io\u002Fdocumentation\u002Fstable\u002Finstall.html>`_.\n\n.. code:: shell\n\n    sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config\n    pip install --global-option=build_ext \\\n    --global-option=\"-I\u002Fusr\u002Flocal\u002Finclude\u002Fgraphviz\u002F\" \\\n    --global-option=\"-L\u002Fusr\u002Flocal\u002Flib\u002Fgraphviz\" pygraphviz\n\nExample: Effect identification and estimation\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nMost causal tasks in DoWhy only require a few lines of code to write. Here, we exemplarily estimate the causal effect of\na treatment on an outcome variable:\n\n.. code:: python\n\n    from dowhy import CausalModel\n    import dowhy.datasets\n\n    # Load some sample data\n    data = dowhy.datasets.linear_dataset(\n        beta=10,\n        num_common_causes=5,\n        num_instruments=2,\n        num_samples=10000,\n        treatment_is_binary=True)\n\nA causal graph can be defined in different way, but the most common way is via `NetworkX \u003Chttps:\u002F\u002Fnetworkx.org\u002F>`_.\nAfter loading in the data, we use the four main operations for effect estimation in DoWhy: *model*, *identify*,\n*estimate* and *refute*:\n\n.. code:: python\n\n    # I. Create a causal model from the data and given graph.\n    model = CausalModel(\n        data=data[\"df\"],\n        treatment=data[\"treatment_name\"],\n        outcome=data[\"outcome_name\"],\n        graph=data[\"gml_graph\"])  # Or alternatively, as nx.DiGraph\n\n    # II. Identify causal effect and return target estimands\n    identified_estimand = model.identify_effect()\n\n    # III. Estimate the target estimand using a statistical method.\n    estimate = model.estimate_effect(identified_estimand,\n                                     method_name=\"backdoor.propensity_score_matching\")\n\n    # IV. Refute the obtained estimate using multiple robustness checks.\n    refute_results = model.refute_estimate(identified_estimand, estimate,\n                                           method_name=\"random_common_cause\")\n\nDoWhy stresses on the interpretability of its output. At any point in the analysis,\nyou can inspect the untested assumptions, identified estimands (if any), and the\nestimate (if any). Here's a sample output of the linear regression estimator:\n\n.. image:: https:\u002F\u002Fraw.githubusercontent.com\u002Fpy-why\u002Fdowhy\u002Fmain\u002Fdocs\u002Fimages\u002Fregression_output.png\n    :width: 80%\n\nFor a full code example, check out the `Getting Started with DoWhy \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fdowhy_simple_example.html>`_ notebook.\n\nYou can also use Conditional Average Treatment Effect (CATE) estimation methods from `EconML \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Feconml>`_, as shown in the `Conditional Treatment Effects \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fdowhy-conditional-treatment-effects.html>`_ notebook. Here's a code snippet.\n\n.. code:: python\n\n\tfrom sklearn.preprocessing import PolynomialFeatures\n\tfrom sklearn.linear_model import LassoCV\n\tfrom sklearn.ensemble import GradientBoostingRegressor\n\tdml_estimate = model.estimate_effect(identified_estimand, method_name=\"backdoor.econml.dml.DML\",\n                        control_value = 0,\n                        treatment_value = 1,\n                        target_units = lambda df: df[\"X0\"]>1,\n                        confidence_intervals=False,\n                        method_params={\n                            \"init_params\":{'model_y':GradientBoostingRegressor(),\n                                           'model_t': GradientBoostingRegressor(),\n                                           'model_final':LassoCV(),\n                                           'featurizer':PolynomialFeatures(degree=1, include_bias=True)},\n                            \"fit_params\":{}})\n\n\nExample: Graphical causal model (GCM) based inference\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nDoWhy's graphical causal model framework offers powerful tools to address causal questions beyond effect estimation.\nIt is based on Pearl's graphical causal model framework and models the causal data generation process of each variable\nexplicitly via *causal mechanisms* to support a wide range of causal algorithms. For more details, see the book\n`Elements of Causal Inference \u003Chttps:\u002F\u002Fmitpress.mit.edu\u002F9780262037310\u002Felements-of-causal-inference\u002F>`_.\n\nComplex causal queries, such as attributing observed anomalies to nodes in the system, can be performed with just a few\nlines of code:\n\n.. code:: python\n\n    import networkx as nx, numpy as np, pandas as pd\n    from dowhy import gcm\n\n    # Let's generate some \"normal\" data we assume we're given from our problem domain:\n    X = np.random.normal(loc=0, scale=1, size=1000)\n    Y = 2 * X + np.random.normal(loc=0, scale=1, size=1000)\n    Z = 3 * Y + np.random.normal(loc=0, scale=1, size=1000)\n    data = pd.DataFrame(dict(X=X, Y=Y, Z=Z))\n\n    # 1. Modeling cause-effect relationships as a structural causal model\n    #    (causal graph + functional causal models):\n    causal_model = gcm.StructuralCausalModel(nx.DiGraph([('X', 'Y'), ('Y', 'Z')]))  # X -> Y -> Z\n    gcm.auto.assign_causal_mechanisms(causal_model, data)\n\n    # 2. Fitting the SCM to the data:\n    gcm.fit(causal_model, data)\n\n    # Optional: Evaluate causal model\n    print(gcm.evaluate_causal_model(causal_model, data))\n\n    # Step 3: Perform a causal analysis.\n    # results = gcm.\u003Ccausal_query>(causal_model, ...)\n    # For instance, root cause analysis:\n    anomalous_sample = pd.DataFrame(dict(X=[0.1], Y=[6.2], Z=[19]))  # Here, Y is the root cause.\n\n    # \"Which node is the root cause of the anomaly in Z?\":\n    anomaly_attribution = gcm.attribute_anomalies(causal_model, \"Z\", anomalous_sample)\n\n    # Or sampling from an interventional distribution. Here, under the intervention do(Y := 2).\n    samples = gcm.interventional_samples(causal_model, interventions={'Y': lambda y: 2}, num_samples_to_draw=100)\n\nThe GCM framework offers many more features beyond these examples. For a full code example, check out the `Online Shop example notebook \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_online_shop.html>`_.\n\nFor more functionalities, example applications of DoWhy and details about the outputs, see the `User Guide \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fuser_guide\u002Fintro.html>`_ or\ncheckout `Jupyter notebooks \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fnb_index.html>`_.\n\nMore Information & Resources\n============================\n`Microsoft Research Blog \u003Chttps:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fblog\u002Fdowhy-a-library-for-causal-inference\u002F>`_ | `Video Tutorial for Effect Estimation \u003Chttps:\u002F\u002Fwww.youtube.com\u002Fwatch?v=LALfQStONEc&t=114s>`_ | `Video Tutorial for Root Cause Analysis \u003Chttps:\u002F\u002Fwww.youtube.com\u002Fwatch?v=icpHrbDlGaw>`_ | `Arxiv Paper \u003Chttps:\u002F\u002Farxiv.org\u002Fabs\u002F2011.04216>`_ | `Arxiv Paper (Graphical Causal Model extension) \u003Chttps:\u002F\u002Farxiv.org\u002Fabs\u002F2206.06821>`_ | `Slides \u003Chttps:\u002F\u002Fwww2.slideshare.net\u002FAmitSharma315\u002Fdowhy-an-endtoend-library-for-causal-inference>`_\n\n\nCiting this package\n~~~~~~~~~~~~~~~~~~~\nIf you find DoWhy useful for your work, please cite **both** of the following two references:\n\n- Amit Sharma, Emre Kiciman. DoWhy: An End-to-End Library for Causal Inference. 2020. https:\u002F\u002Farxiv.org\u002Fabs\u002F2011.04216\n- Patrick Blöbaum, Peter Götz, Kailash Budhathoki, Atalanti A. Mastakouri, Dominik Janzing. DoWhy-GCM: An extension of DoWhy for causal inference in graphical causal models. 2024. MLOSS 25(147):1−7. https:\u002F\u002Fjmlr.org\u002Fpapers\u002Fv25\u002F22-1258.html\n\nBibtex::\n\n  @article{dowhy,\n    title={DoWhy: An End-to-End Library for Causal Inference},\n    author={Sharma, Amit and Kiciman, Emre},\n    journal={arXiv preprint arXiv:2011.04216},\n    year={2020}\n  }\n\n  @article{JMLR:v25:22-1258,\n  author  = {Patrick Bl{{\\\"o}}baum and Peter G{{\\\"o}}tz and Kailash Budhathoki and Atalanti A. Mastakouri and Dominik Janzing},\n  title   = {DoWhy-GCM: An Extension of DoWhy for Causal Inference in Graphical Causal Models},\n  journal = {Journal of Machine Learning Research},\n  year    = {2024},\n  volume  = {25},\n  number  = {147},\n  pages   = {1--7},\n  url     = {http:\u002F\u002Fjmlr.org\u002Fpapers\u002Fv25\u002F22-1258.html}\n  }\n\nIssues\n~~~~~~\nIf you encounter an issue or have a specific request for DoWhy, please `raise an issue \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues>`_.\n\nContributing\n~~~~~~~~~~~~\n\nThis project welcomes contributions and suggestions. For a guide to contributing and a list of all contributors, check out `CONTRIBUTING.md \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002FCONTRIBUTING.md>`_ and our `docs for contributing code \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fcontributing\u002Fcontributing-code.rst>`_. Our `contributor code of conduct is available here \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fgovernance\u002Fblob\u002Fmain\u002FCODE-OF-CONDUCT.md>`_.\n","|构建状态|_ |PyPI版本|_ |Python支持|_ |下载量|_ |Discord|_ |Gurubase|_\n\n.. |PyPiVersion| image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdowhy.svg\n.. _PyPiVersion: https:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F\n\n.. |PythonSupport| image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fdowhy.svg\n.. _PythonSupport: https:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F\n\n.. |BuildStatus| image:: https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg\n.. _BuildStatus: https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Factions\n\n.. |Downloads| image:: https:\u002F\u002Fpepy.tech\u002Fbadge\u002Fdowhy\n.. _Downloads: https:\u002F\u002Fpepy.tech\u002Fproject\u002Fdowhy\n\n.. |discord| image:: https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F818456847551168542\n.. _discord: https:\u002F\u002Fdiscord.gg\u002FcSBGb3vsZb\n\n.. |gurubase| image:: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGurubase-Ask%20DoWhy%20Guru-006BFF\n.. _gurubase: https:\u002F\u002Fgurubase.io\u002Fg\u002Fdowhy\n\n.. image:: dowhy-logo-large.png\n  :width: 50%\n  :align: center\n\n\n`查看文档 \u003Chttps:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F>`_\n===============================================================\n\n- 文档、用户指南、示例笔记本及其他信息可在 `https:\u002F\u002Fpy-why.github.io\u002Fdowhy \u003Chttps:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F>`_ 找到。\n- DoWhy 是 `PyWhy 生态系统 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002F>`_ 的一部分。如需更多与因果推断相关的工具和库，请访问 `PyWhy GitHub 组织 \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002F>`_！\n- 如有任何问题、意见或关于特定用例的讨论，请加入我们的 Discord 社区（|discord|_）。\n- 立即阅读一些案例研究：\n    - 效应估计：`酒店预订取消 \u003Chttps:\u002F\u002Fmedium.com\u002Fdata-science\u002Fbeyond-predictive-models-the-causal-story-behind-hotel-booking-cancellations-d29e8558cbaf>`_ | `客户忠诚度计划的效果 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fdowhy_example_effect_of_memberrewards_program.html>`_ | `优化文章标题 \u003Chttps:\u002F\u002Fmedium.com\u002F@akelleh\u002Fintroducing-the-do-sampler-for-causal-inference-a3296ea9e78d>`_ | `家访对婴儿健康的影响（IHDP）\u003Chttps:\u002F\u002Fmedium.com\u002Fdata-science\u002Fimplementing-causal-inference-a-key-step-towards-agi-de2cde8ea599>`_ | `客户流失的原因 \u003Chttps:\u002F\u002Fmedium.com\u002Fgeekculture\u002Fa-quickstart-for-causal-analysis-decision-making-with-dowhy-2ce2d4d1efa9>`_\n    - 根因分析与解释：`在线商店的因果归因与根因分析 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_online_shop.html>`_ | `微服务架构中延迟升高的根因查找 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_rca_microservice_architecture.html>`_ | `供应链变化的根因查找 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_supply_chain_dist_change.html>`_\n\n更多示例笔记本请见 `这里！ \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fnb_index.html>`_\n\n简介与核心特性\n===========================\n决策制定涉及理解不同变量之间的相互影响，并预测当其中某些变量被调整为新值时的结果。例如，给定一个结果变量，人们可能希望确定某种行动对其产生的影响、了解其当前值的成因，或者模拟改变某些变量后会发生什么。回答这类问题需要进行因果推理。DoWhy 是一个 Python 库，它引导您完成因果推理的各个步骤，并提供统一的接口来解答因果问题。\n\nDoWhy 提供了多种用于效应估计、预测、量化因果影响、诊断因果结构、根因分析、干预及反事实分析的算法。DoWhy 的一项关键特性是其反驳与证伪 API，可用于检验任何估计方法背后的因果假设，从而使推断更加稳健，并让非专业人士也能轻松使用。\n\n**图形化因果模型与潜在结果：兼得两者之优**\n\nDoWhy 基于因果推断领域中两个最强大的框架：图形化因果模型和潜在结果框架。在效应估计方面，它利用基于图的准则和 do-演算来建模假设并识别非参数化的因果效应。而在具体估计过程中，则切换到主要基于潜在结果的方法。\n\n对于超出效应估计范围的其他因果问题，DoWhy 充分发挥图形化因果模型的优势，通过在每个节点上明确地建模数据生成机制来描述数据的产生过程，从而能够将观察到的效应归因于特定变量，或估算逐点的反事实。\n\n如需快速了解因果推断，可参考 `amit-sharma\u002Fcausal-inference-tutorial \u003Chttps:\u002F\u002Fgithub.com\u002Famit-sharma\u002Fcausal-inference-tutorial\u002F>`_。我们还在 ACM 知识发现与数据挖掘（`KDD 2018 \u003Chttp:\u002F\u002Fwww.kdd.org\u002Fkdd2018\u002F>`_）会议上提供了更为全面的教程：`causalinference.gitlab.io\u002Fkdd-tutorial \u003Chttp:\u002F\u002Fcausalinference.gitlab.io\u002Fkdd-tutorial\u002F>`_。若想了解因果推断的四个步骤及其对机器学习的影响，可观看微软研究院的视频教程 `DoWhy 网络研讨会 \u003Chttps:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fvideo\u002Ffoundations-of-causal-inference-and-its-impacts-on-machine-learning\u002F>`_；而有关图形化因果模型 API 的介绍，则可参阅 `PyCon 上关于使用 DoWhy 进行根因分析的演讲 \u003Chttps:\u002F\u002Fwww.youtube.com\u002Fwatch?v=icpHrbDlGaw>`_。\n\n核心特性\n~~~~~~~~~~~~\n\n.. image:: https:\u002F\u002Fraw.githubusercontent.com\u002Fpy-why\u002Fdowhy\u002Fmain\u002Fdocs\u002Fimages\u002Fdowhy-features.png\n\nDoWhy 支持以下因果任务：\n\n- 效应估计（识别、平均因果效应、条件平均因果效应、工具变量等）\n- 量化因果影响（中介效应分析、直接路径强度、内在因果影响力）\n- 假设分析（从干预分布中生成样本，估计反事实）\n- 根因分析与解释（将异常归因于其原因，找出分布变化的原因，评估特征相关性等）\n\n更多详细信息及实际使用方法，请查阅 `https:\u002F\u002Fpy-why.github.io\u002Fdowhy \u003Chttps:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F>`_ 处的文档。\n\n快速入门\n===========\nDoWhy 支持 Python 3.8 及以上版本。您可以通过 pip、poetry 或 conda 来安装。\n\n**最新版本**\n\n使用 pip 安装最新的 `发布版本 \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F>`__。\n\n.. code:: shell\n\n   pip install dowhy\n\n使用 poetry 安装最新的 `发布版本 \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fdowhy\u002F>`__。\n\n.. code:: shell\n\n   poetry add dowhy\n\n使用 conda 安装最新的 `发布版本 \u003Chttps:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fdowhy>`__。\n\n.. code:: shell\n\n   conda install -c conda-forge dowhy\n\n如果您在使用 conda 时遇到“解决环境”问题，请尝试运行 :code:`conda update --all`，然后安装 dowhy。如果仍然无效，请使用 :code:`conda config --set channel_priority false` 并再次尝试安装。若问题依旧存在，请在此处 `提交您的问题 \u003Chttps:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fissues\u002F197>`_。\n\n**开发版本**\n\n如果您希望使用最新的开发版本，您的依赖管理工具需要指向我们的 GitHub 仓库。\n\n.. code:: shell\n\n    pip install git+https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy@main\n\n\n**要求**\n\nDoWhy 需要一些依赖项。具体版本信息可在 `pyproject.toml \u003C.\u002Fpyproject.toml>`_ 的 `tool.poetry.dependencies` 部分找到。\n\n如果您遇到任何问题，可以尝试手动安装这些依赖项。\n\n.. code:: shell\n\n    pip install '\u003Cdependency-name>==\u003Cversion>'\n\n此外，如果您希望以 dot 格式输入图结构，可以安装 pydot（或 pygraphviz）。\n\n为了获得更美观的图形，您还可以选择安装 pygraphviz。为此，首先需要安装 graphviz，然后再安装 pygraphviz（适用于 Ubuntu 和 Ubuntu WSL）。\n\n.. note::\n    在某些平台上安装 pygraphviz 可能会遇到问题。对于大多数 Linux 发行版而言，一个可行的方法是先安装 graphviz，再安装 pygraphviz，如下所示。否则，请参考 `pygraphviz 的官方文档 \u003Chttps:\u002F\u002Fpygraphviz.github.io\u002Fdocumentation\u002Fstable\u002Finstall.html>`_。\n\n.. code:: shell\n\n    sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config\n    pip install --global-option=build_ext \\\n    --global-option=\"-I\u002Fusr\u002Flocal\u002Finclude\u002Fgraphviz\u002F\" \\\n    --global-option=\"-L\u002Fusr\u002Flocal\u002Flib\u002Fgraphviz\" pygraphviz\n\n示例：效应识别与估计\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n在 DoWhy 中，大多数因果推断任务只需几行代码即可完成。以下我们以估计治疗对结果变量的因果效应为例：\n\n.. code:: python\n\n    from dowhy import CausalModel\n    import dowhy.datasets\n\n    # 加载一些示例数据\n    data = dowhy.datasets.linear_dataset(\n        beta=10,\n        num_common_causes=5,\n        num_instruments=2,\n        num_samples=10000,\n        treatment_is_binary=True)\n\n因果图可以用多种方式定义，但最常见的方式是通过 `NetworkX \u003Chttps:\u002F\u002Fnetworkx.org\u002F>`_。加载数据后，我们使用 DoWhy 中用于效应估计的四个主要步骤：*建模*、*识别*、*估计* 和 *反驳*：\n\n.. code:: python\n\n    # I. 根据数据和给定的图构建因果模型。\n    model = CausalModel(\n        data=data[\"df\"],\n        treatment=data[\"treatment_name\"],\n        outcome=data[\"outcome_name\"],\n        graph=data[\"gml_graph\"])  # 或者也可以用 nx.DiGraph 表示\n\n    # II. 识别因果效应并返回目标估计量\n    identified_estimand = model.identify_effect()\n\n    # III. 使用统计方法估计目标估计量。\n    estimate = model.estimate_effect(identified_estimand,\n                                     method_name=\"backdoor.propensity_score_matching\")\n\n    # IV. 通过多种稳健性检验来反驳所得估计。\n    refute_results = model.refute_estimate(identified_estimand, estimate,\n                                           method_name=\"random_common_cause\")\n\nDoWhy 强调其输出的可解释性。在分析的任何阶段，您可以检查未验证的假设、已识别的估计量（如有）以及估计值（如有）。以下是线性回归估计器的一个示例输出：\n\n.. image:: https:\u002F\u002Fraw.githubusercontent.com\u002Fpy-why\u002Fdowhy\u002Fmain\u002Fdocs\u002Fimages\u002Fregression_output.png\n    :width: 80%\n\n有关完整的代码示例，请参阅 `开始使用 DoWhy \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fdowhy_simple_example.html>`_ 笔记本。\n\n您还可以使用来自 `EconML \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Feconml>`_ 的条件平均处理效应 (CATE) 估计方法，如 `条件处理效应 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fdowhy-conditional-treatment-effects.html>`_ 笔记本中所示。以下是一个代码片段。\n\n.. code:: python\n\n\tfrom sklearn.preprocessing import PolynomialFeatures\n\tfrom sklearn.linear_model import LassoCV\n\tfrom sklearn.ensemble import GradientBoostingRegressor\n\tdml_estimate = model.estimate_effect(identified_estimand, method_name=\"backdoor.econml.dml.DML\",\n                        control_value = 0,\n                        treatment_value = 1,\n                        target_units = lambda df: df[\"X0\"]>1,\n                        confidence_intervals=False,\n                        method_params={\n                            \"init_params\":{'model_y':GradientBoostingRegressor(),\n                                           'model_t': GradientBoostingRegressor(),\n                                           'model_final':LassoCV(),\n                                           'featurizer':PolynomialFeatures(degree=1, include_bias=True)},\n                            \"fit_params\":{}})\n\n\n示例：基于图因果模型 (GCM) 的推断\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nDoWhy 的图因果模型框架提供了强大的工具，可用于解决效应估计之外的因果问题。它基于 Pearl 的图因果模型框架，通过 *因果机制* 显式建模每个变量的因果数据生成过程，从而支持广泛的因果算法。更多详细信息请参阅书籍《因果推断要素》（`Elements of Causal Inference \u003Chttps:\u002F\u002Fmitpress.mit.edu\u002F9780262037310\u002Felements-of-causal-inference\u002F>`_）。\n\n诸如将观测到的异常归因于系统中的某个节点等复杂因果查询，仅需几行代码即可完成：\n\n.. code:: python\n\n    import networkx as nx, numpy as np, pandas as pd\n    from dowhy import gcm\n\n    # 假设我们从实际问题领域获得了一些“正常”数据：\n    X = np.random.normal(loc=0, scale=1, size=1000)\n    Y = 2 * X + np.random.normal(loc=0, scale=1, size=1000)\n    Z = 3 * Y + np.random.normal(loc=0, scale=1, size=1000)\n    data = pd.DataFrame(dict(X=X, Y=Y, Z=Z))\n\n    # 1. 将因果关系建模为结构化因果模型\n    #    （因果图 + 功能性因果模型）：\n    causal_model = gcm.StructuralCausalModel(nx.DiGraph([('X', 'Y'), ('Y', 'Z')]))  # X -> Y -> Z\n    gcm.auto.assign_causal_mechanisms(causal_model, data)\n\n    # 2. 将 SCM 拟合到数据上：\n    gcm.fit(causal_model, data)\n\n    # 可选：评估因果模型\n    print(gcm.evaluate_causal_model(causal_model, data))\n\n    # 第三步：进行因果分析。\n    # results = gcm.\u003Ccausal_query>(causal_model, ...)\n    # 例如，根本原因分析：\n    anomalous_sample = pd.DataFrame(dict(X=[0.1], Y=[6.2], Z=[19]))  # 这里，Y 是根本原因。\n\n    # “Z 中的异常是由哪个节点引起的？”:\n    anomaly_attribution = gcm.attribute_anomalies(causal_model, \"Z\", anomalous_sample)\n\n# 或者从干预分布中采样。这里，在干预 do(Y := 2) 下。\n    samples = gcm.interventional_samples(causal_model, interventions={'Y': lambda y: 2}, num_samples_to_draw=100)\n\nGCM 框架除了这些示例之外，还提供了许多其他功能。如需完整的代码示例，请查看“在线商店示例笔记本 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fgcm_online_shop.html>`_。\n\n如需了解更多功能、DoWhy 的应用示例以及输出的详细信息，请参阅《用户指南 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fuser_guide\u002Fintro.html>`_》或浏览 `Jupyter 笔记本 \u003Chttps:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fexample_notebooks\u002Fnb_index.html>`_。\n\n更多信息与资源\n============================\n`微软研究博客 \u003Chttps:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fblog\u002Fdowhy-a-library-for-causal-inference\u002F>`_ | `效应估计视频教程 \u003Chttps:\u002F\u002Fwww.youtube.com\u002Fwatch?v=LALfQStONEc&t=114s>`_ | `根本原因分析视频教程 \u003Chttps:\u002F\u002Fwww.youtube.com\u002Fwatch?v=icpHrbDlGaw>`_ | `ArXiv 论文 \u003Chttps:\u002F\u002Farxiv.org\u002Fabs\u002F2011.04216>`_ | `ArXiv 论文（图形因果模型扩展）\u003Chttps:\u002F\u002Farxiv.org\u002Fabs\u002F2206.06821>`_ | `幻灯片 \u003Chttps:\u002F\u002Fwww2.slideshare.net\u002FAmitSharma315\u002Fdowhy-an-endtoend-library-for-causal-inference>`_\n\n\n引用本软件包\n~~~~~~~~~~~~~~~~~~~\n如果您发现 DoWhy 对您的工作有所帮助，请同时引用以下两篇文献：\n\n- Amit Sharma, Emre Kiciman. DoWhy：用于因果推断的端到端库。2020年。https:\u002F\u002Farxiv.org\u002Fabs\u002F2011.04216\n- Patrick Blöbaum, Peter Götz, Kailash Budhathoki, Atalanti A. Mastakouri, Dominik Janzing. DoWhy-GCM：针对图形因果模型中因果推断的 DoWhy 扩展。2024年。MLOSS 25(147):1−7。https:\u002F\u002Fjmlr.org\u002Fpapers\u002Fv25\u002F22-1258.html\n\nBibTeX 格式::\n\n  @article{dowhy,\n    title={DoWhy: An End-to-End Library for Causal Inference},\n    author={Sharma, Amit and Kiciman, Emre},\n    journal={arXiv preprint arXiv:2011.04216},\n    year={2020}\n  }\n\n  @article{JMLR:v25:22-1258,\n  author  = {Patrick Bl{{\\\"o}}baum and Peter G{{\\\"o}}tz and Kailash Budhathoki and Atalanti A. Mastakouri and Dominik Janzing},\n  title   = {DoWhy-GCM: An Extension of DoWhy for Causal Inference in Graphical Causal Models},\n  journal = {Journal of Machine Learning Research},\n  year    = {2024},\n  volume  = {25},\n  number  = {147},\n  pages   = {1--7},\n  url     = {http:\u002F\u002Fjmlr.org\u002Fpapers\u002Fv25\u002F22-1258.html}\n  }\n\n问题\n~~~~~~\n如果您在使用 DoWhy 时遇到问题或有特定需求，请在 `GitHub 上提交问题 \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues>`_。\n\n贡献\n~~~~~~~~~~~~\n\n本项目欢迎各种形式的贡献和建议。有关贡献指南及所有贡献者的列表，请参阅 `CONTRIBUTING.md \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002FCONTRIBUTING.md>`_ 和我们的 `代码贡献文档 \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fcontributing\u002Fcontributing-code.rst>`_。我们的 `贡献者行为准则在此处提供 \u003Chttps:\u002F\u002Fgithub.com\u002Fpy-why\u002Fgovernance\u002Fblob\u002Fmain\u002FCODE-OF-CONDUCT.md>`_。","# DoWhy 快速上手指南\n\nDoWhy 是一个强大的 Python 因果推断库，旨在通过统一的接口引导用户完成因果建模、识别、估计和反驳的全过程。它结合了图形因果模型和潜在结果框架的优势，帮助开发者稳健地评估变量间的因果关系。\n\n## 环境准备\n\n*   **操作系统**：支持 Linux, macOS, Windows (WSL 推荐用于绘图功能)。\n*   **Python 版本**：Python 3.8 或更高版本。\n*   **前置依赖**：\n    *   核心功能仅需标准 Python 环境。\n    *   **可选依赖（绘图）**：若需输入 DOT 格式图谱或生成高质量因果图，需安装 `graphviz` 系统包及 `pygraphviz`。\n        *   *Ubuntu\u002FDebian*: `sudo apt install graphviz libgraphviz-dev`\n        *   *macOS (Homebrew)*: `brew install graphviz`\n\n## 安装步骤\n\n推荐使用国内镜像源加速安装。\n\n### 方法一：使用 pip 安装（推荐）\n\n```bash\npip install dowhy -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方法二：使用 Conda 安装\n\n```bash\nconda install -c conda-forge dowhy\n```\n*注：若遇到 \"Solving environment\" 问题，可尝试先运行 `conda update --all` 或配置 `conda config --set channel_priority false`。*\n\n### 方法三：安装开发版\n\n```bash\npip install git+https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy@main\n```\n\n### 可选：安装绘图支持\n\n若需使用高级绘图功能，请在安装系统级 `graphviz` 后执行：\n\n```bash\npip install pygraphviz --global-option=build_ext --global-option=\"-I\u002Fusr\u002Flocal\u002Finclude\u002Fgraphviz\u002F\" --global-option=\"-L\u002Fusr\u002Flocal\u002Flib\u002Fgraphviz\"\n```\n\n## 基本使用\n\nDoWhy 的核心工作流包含四个步骤：**建模 (Model)** -> **识别 (Identify)** -> **估计 (Estimate)** -> **反驳 (Refute)**。\n\n以下是一个完整的极简示例，演示如何估计处理变量对结果变量的因果效应：\n\n```python\nfrom dowhy import CausalModel\nimport dowhy.datasets\n\n# 1. 加载示例数据\ndata = dowhy.datasets.linear_dataset(\n    beta=10,\n    num_common_causes=5,\n    num_instruments=2,\n    num_samples=10000,\n    treatment_is_binary=True)\n\n# 2. 构建因果模型\n# 可以通过 GML 字符串或 NetworkX 图对象定义因果图\nmodel = CausalModel(\n    data=data[\"df\"],\n    treatment=data[\"treatment_name\"],\n    outcome=data[\"outcome_name\"],\n    graph=data[\"gml_graph\"]\n)\n\n# 3. 识别因果效应\n# 基于因果图判断效应是否可识别，并返回目标估计量\nidentified_estimand = model.identify_effect()\n\n# 4. 估计因果效应\n# 使用统计方法（如倾向得分匹配）进行估算\nestimate = model.estimate_effect(\n    identified_estimand,\n    method_name=\"backdoor.propensity_score_matching\"\n)\n\nprint(f\"估计的因果效应: {estimate.value}\")\n\n# 5. 反驳验证 (鲁棒性检查)\n# 通过添加随机共同原因等方法验证估计结果的稳健性\nrefute_results = model.refute_estimate(\n    identified_estimand, \n    estimate,\n    method_name=\"random_common_cause\"\n)\n```\n\n**进阶提示**：\n*   DoWhy 支持与 `EconML` 集成，用于条件平均处理效应 (CATE) 估计。\n*   对于根因分析 (RCA) 和反事实推断，可探索 DoWhy 的 GCM (Graphical Causal Model) 模块。","某电商数据团队正在评估“新用户注册送 20 元优惠券”活动对长期复购率的真实影响，以决定下一季度的预算分配。\n\n### 没有 dowhy 时\n- 团队仅依赖相关性分析，误将“高消费意愿用户更爱领券”当作因果结论，导致高估活动效果。\n- 无法量化“未领券用户若领券会怎样”的反事实场景，难以排除自然增长或季节性因素的干扰。\n- 缺乏系统性的假设检验机制，不同分析师使用不同模型得出的结论相互矛盾，决策层不敢拍板。\n- 面对业务方质疑“是否只是运气好”，只能凭经验辩解，缺少统计显著性的反驳证据。\n\n### 使用 dowhy 后\n- 通过构建因果图明确区分混淆变量（如用户活跃度），精准分离出优惠券带来的净增量效应。\n- 利用反事实推理模拟“若无该活动”的基准线，量化证明活动实际提升了 15% 的复购率，而非表面看到的 30%。\n- 调用内置的证伪（Refutation）API，自动通过随机置换干预值等方法测试模型稳健性，用数据回击了“结果偶然论”。\n- 统一了从建模、估计到验证的标准流程，让非算法背景的产品经理也能看懂并信任分析结论。\n\ndowhy 将模糊的业务直觉转化为可验证的因果证据，帮助企业在复杂环境中做出经得起推敲的战略决策。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fpy-why_dowhy_d21cb19e.png","py-why","PyWhy","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fpy-why_06a37496.png","",null,"pywhy.org","https:\u002F\u002Fgithub.com\u002Fpy-why",[80],{"name":81,"color":82,"percentage":83},"Python","#3572A5",100,8055,1020,"2026-04-11T09:47:45","MIT","Linux, macOS, Windows","未说明",{"notes":91,"python":92,"dependencies":93},"该工具主要用于因果推断，通常不需要 GPU。若需输入 DOT 格式图表或生成更美观的图形，需额外安装 graphviz 和 pygraphviz（在 Linux 上建议先通过 apt 安装 graphviz 及相关开发库）。如遇 conda 安装环境问题，可尝试更新 conda 或调整通道优先级。支持通过 pip、poetry 或 conda 安装。","3.8+",[94,95,96,97,98],"networkx","pydot","pygraphviz (可选)","graphviz (可选，用于绘图)","econml (可选，用于 CATE 估计)",[16,14,100],"其他",[102,103,104,105,106,107,108,109,110,111,112],"causal-inference","machine-learning","graphical-models","bayesian-networks","data-science","python3","causality","causal-models","treatment-effects","do-calculus","causal-machine-learning","2026-03-27T02:49:30.150509","2026-04-11T23:30:10.480711",[116,121,126,131,136,141],{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},30025,"如何量化特征（节点）对目标变量的贡献或影响？应该使用 arrow_strength、intrinsic_causal_influence 还是 parent_relevance？","这三个函数底层逻辑不同，结果差异大是正常的。针对分类特征多导致模型效果差的问题，建议：\n1. 尝试更强大的预测模型（如 AutoGluon），虽然计算会变慢。\n2. 不要随意删除分类值以免丢失信息，若必须简化，可合并次要类别或引入虚拟类别。\n3. 为加速 Bootstrap 计算，在 ShapleyConfig 中添加参数 approximation_method = ShapleyApproximationMethods.PERMUTATION。\n4. 增加 Bootstrap 运行次数以提高结果一致性。\n5. 对于大型数据集和较少类别的情况，结果通常更一致；若条件不满足，可尝试调整重采样次数（resamples count）或使用逻辑回归分类器（ClassifierFCM）。","https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues\u002F1169",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},30026,"为什么使用倾向评分方法估计因果效应时报错说处理变量（treatment）必须是二元的，但我已经使用了二元变量？","这通常取决于处理变量和结果变量的取值范围。如果两者都在 [0,1] 之间，因果效应通常在 0 到 1 之间；但如果结果变量范围较大（例如 -10 到 35），因果效应完全可能大于 1，这是由相对尺度决定的，并非错误。\n关于条件变量：estimate_effect 方法会自动根据 CausalModel 中提供的 common_causes 进行条件化处理。若想改变输出所基于的特征条件，只需修改 CausalModel 调用中的 common_causes 参数即可。","https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues\u002F150",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},30027,"DoWhy 是否支持因果发现（Causal Discovery）算法？","是的，DoWhy 已添加了实验性的因果发现功能实现。它依赖于现有标准算法的实现，并提供了一个 API 包装器以标准化接口并支持多种方法。\n用户可以参考官方示例 Notebook 进行尝试：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_causal_discovery_example.ipynb\n注意：目前该功能较为基础，不同方法的结果可能不一致，欢迎社区贡献以扩展此功能。","https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues\u002F98",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},30028,"DoWhy 是否支持生存分析或时间至事件（Time-to-Event）数据？","目前 DoWhy 主要关注二元、连续或计数类型的传统结果变量，尚未原生支持生存分析。但开发团队对此有需求且持开放态度。\n社区成员建议可以集成现有的反事实生存分析工作（如 https:\u002F\u002Fgithub.com\u002Fpaidamoyo\u002Fcounterfactual_survival_analysis）。如果你需要此功能，可以参考相关项目或关注未来的更新计划。","https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues\u002F1285",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},30029,"为什么使用线性回归进行因果效应估计时结果不可复现，而倾向评分匹配却是可复现的？","线性回归结果不可复现通常是因为底层使用的优化算法或随机种子未固定。在使用 scikit-learn 等库的线性模型时，务必设置 random_state 参数以确保结果可复现。例如，在定义模型时传入 random_state=42。此外，检查数据预处理步骤（如缺失值填充、标准化）是否也引入了随机性，并确保这些步骤同样固定了随机种子。","https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fissues\u002F27",{"id":142,"question_zh":143,"answer_zh":144,"source_url":125},30030,"在因果推断中，CATE（条件平均处理效应）的值为什么会大于 1？正常范围不是 0 到 1 吗？","CATE 的值并不限制在 0 到 1 之间。其数值大小完全取决于结果变量（Outcome）和处理变量（Treatment）的量纲和尺度。如果结果变量的取值范围很大（例如收入从 -10 到 35），那么计算出的因果效应（CATE）完全可能大于 1。这表示处理变量每增加一个单位，结果变量平均变化的绝对数值，而非概率比例。",[146,151,156,161,166,171,176,181,186,191,196,201,206,211,216,221,226,231],{"id":147,"version":148,"summary_zh":149,"released_at":150},206615,"v0.14","- **[新增]** 双重稳健估计量 [[示例笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_doubly_robust_estimator.ipynb)]\n- **[新增]** 将 DecisionTreeClassifier 作为 'GOOD' gcm 分类器集合中的一个选项\n- 改进了 gcm 中自动选择的分类器模型的校准\n- 提升了因果预测算法的性能\n- 支持 Python 3.13，可使用 uv 进行安装\n\n特别感谢 @amit-sharma、@bloebp、@emmanuel-ferdman、@JPZ4-5 和 @nparent1 对本次发布的贡献。\n更多详情如下。\n\n## 变更内容\n* 添加 Python 3.13 支持并更新依赖项，由 @bloebp 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1328 中完成\n* 修正线性检验中的垂直堆叠问题，由 @emmanuel-ferdman 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1336 中完成\n* 修复条件正则化器中的 CUDA 错误，由 @JPZ4-5 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1341 中完成\n* 修复 pandas 的未来警告错误，由 @amit-sharma 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1339 中完成\n* 功能：使用 torch.cdist 计算高斯核以提升性能，由 @JPZ4-5 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1358 中完成\n* 双重稳健估计量，由 @nparent1 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1346 中完成\n* 修订 GCM 分类器模型选择逻辑，由 @bloebp 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1349 中完成\n* 启用使用 uv 安装，由 @amit-sharma 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1362 中完成\n\n## 新贡献者\n* @emmanuel-ferdman 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1336 中完成了首次贡献\n* @JPZ4-5 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1341 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fcompare\u002Fv0.13...v0.14","2025-11-08T05:02:40",{"id":152,"version":153,"summary_zh":154,"released_at":155},206616,"v0.13","## 变更内容\n\n* @nparent1 实现了对广义调整准则的支持，用于识别和估计\n     * 示例笔记本：[识别](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_generalized_covariate_adjustment_example.ipynb)、[估计](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_generalized_covariate_adjustment_estimation_example.ipynb)\n* @bloebp 为 GCM 添加了实验性的缺失数据支持\n* 更好的版本兼容性，支持最新版本的软件包（例如 network >= 3.5、cython >= 3）\n* 修复了若干 bug，并提升了效率\n\n## 新贡献者\n* @mbeale 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1291 中完成了首次贡献\n* @williambdean 在 https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fpull\u002F1308 中完成了首次贡献\n\n在此向本版本的所有贡献者表示衷心感谢！\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fcompare\u002Fv0.12...v0.13","2025-07-12T13:37:38",{"id":157,"version":158,"summary_zh":159,"released_at":160},206617,"v0.12","新增功能和示例笔记本，修复了多个 bug，并提升了运行时性能。现已兼容 Python 3.12。\n\n* 支持 Python 3.12\n* 引入一种更稳健、收敛更快的分布变化方法（乘法稳健的因果变化归因，[Quintas-Martinez 等人，2024](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.08839)）\n* 支持对时间序列数据进行效应估计（[笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Ftimeseries\u002Feffect_inference_timeseries_data.ipynb)）\n* 新增基于秩的异常评分器\n* 新增关于销售归因的示例笔记本（[笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fsales_attribution_intervention.ipynb)）\n* 新增应用 DoWhy 进行反事实公平性分析的示例笔记本（[笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fcounterfactual_fairness_dowhy.ipynb)）\n* 其他提升效率的更新\n* 如有任何关于 DoWhy 的疑问，请使用 [Gurubase.io](https:\u002F\u002Fgurubase.io\u002Fg\u002Fdowhy) 提问\n\n贡献者：@bloebp、@amit-sharma、@kursataktas、@vivianqin214、@kapkic、@GregVS、@kmhj13、@yangliu-SY、@nparent1、@rahulbshrestha、@srivhash、@darthtrevino、@yogabonito、@jonlives、@krz、@victor5as、@sinhaharsh、@Zethson、@dw-610、@diligejy","2024-11-24T07:33:52",{"id":162,"version":163,"summary_zh":164,"released_at":165},206618,"v0.11.1","* 新功能：允许用户为每个节点的DGP编写方程，并返回已分配机制的因果模型 (#1106)\n* 便捷函数：从CausalModel中访问拟合好的估计器实例 (#1113)\n* 基于核的独立性检验和networkx绘图函数的缺陷修复\n* 置信区间和回归估计器的相关缺陷修复\n* CI\u002FCD的一些改进（每次PR自动检查README、更新软件包发布流程、修复超时错误）\n\n贡献者：@bhatt-priyadutt、@drawlinson、@bloebp、@amit-sharma","2023-12-25T07:08:29",{"id":167,"version":168,"summary_zh":169,"released_at":170},206619,"v0.11","\r\n* 新的功能性 API 已经准备就绪，可供使用。请尝试[笔记本](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fv0.11\u002Fexample_notebooks\u002Fdowhy_functional_api.html)。\n* 一个[笔记本](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fv0.11\u002Fexample_notebooks\u002Fdowhy_causal_discovery_example.html)，展示了如何将 causal-learn 图发现方法与 DoWhy 结合使用。\n* 新的[笔记本](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fv0.11\u002Fexample_notebooks\u002Fgcm_icc.html)，演示了内在因果影响力功能的使用。\n* GCM 与 CausalModel API 之间的兼容性得到了增强。\n* 前门识别现在支持多个变量。\n* 新的[模块](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fv0.11\u002Fuser_guide\u002Fmodeling_gcm\u002Fmodel_evaluation.html)，用于评估 GCM 模型的性能并检验假设是否成立。\n* GCM 自动赋值现在会返回摘要。\n* 文档得到扩展，README 文件经过修订并更加简洁。\n* 修复了若干 bug 并进行了改进。\n\n特别感谢所有贡献者：@amit-sharma、@bloebp、@kunwuz。","2023-12-06T08:12:27",{"id":172,"version":173,"summary_zh":174,"released_at":175},206620,"v0.10.1","这是一个补丁版本。\n* 新增对介入性结果的暴露支持（@drawlinson）\n* 修复了对 Pandas 2.0 的支持相关 bug（@bloebp）以及统计检验的置信值问题（@amit-sharma）\n* 在 GCM 中增加了不变节点的相关内容（@bhatt-priyadutt）\n* 修复了发布流水线问题（@kbattocchi）\n\n感谢各位为本次补丁提交问题和修复！","2023-09-05T04:59:40",{"id":177,"version":178,"summary_zh":179,"released_at":180},206621,"v0.10","* 现推出更新版的 **[用户指南](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fmain\u002Fuser_guide\u002Fintro.html)**，帮助您更好地理解因果推断领域。该指南是学习各种因果任务、判断哪些任务与您相关，以及如何使用 DoWhy 实现这些任务的绝佳资源。\n* **因果预测** 是 DoWhy 最新支持的任务！请尝试 @jivatneet 编写的 [预测笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fprediction\u002Fdowhy_causal_prediction_demo.ipynb)。\n* 一种用于 **验证因果图** 的新技术。请查看 @eeulig 编写的 [笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fgcm_falsify_dag.ipynb)。\n* **新增反驳方法**：Overrule，用于学习布尔规则来描述数据的支持情况以及处理组和对照组之间的重叠部分。请参阅 @moberst 编写的 [笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_refuter_assess_overlap.ipynb)。\n* 新增了一种用于估计单一样本内在因果效应的方法。\n* 重构了估计器 API，支持将拟合和估计步骤分开进行。\n* 对 GCM 方法进行了多项优化和提速。\n* 支持 Python 3.11，并简化了依赖项列表。\n\n在此向所有贡献者表示衷心感谢：@AlxndrMlk、@amit-sharma、@andresmor-ms、@bloebp、@darthtrevino、@eeulig、@eltociear、@emrekiciman、@jivatneet、@kbattocchi、@Klesel、@MFreidank、@MichaelMarien、@moberst、@Padarn、@petergtz、@RoseDeSicilia26、@sgrimbly、@vspinu、@yoshiakifukushima、@Zethson。","2023-07-30T13:54:28",{"id":182,"version":183,"summary_zh":184,"released_at":185},206622,"v0.9.1","v0.9 的小幅更新。\n\n* 支持 Python 3.10\n* 简化了 dowhy 包的依赖结构（减少所需依赖）\n* 为图表添加颜色选项 (@eeulig)\n\n感谢 @darthtrevino、@petergtz 和 @andresmor-ms 推动本次发布！","2022-12-17T06:13:06",{"id":187,"version":188,"summary_zh":189,"released_at":190},206623,"v0.9","* 新功能 API 预览（详见 [笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_functional_api.ipynb)）。该新 API 目前处于实验阶段，支持对各项功能的模块化使用，并为因果估计器提供了独立的拟合和估计方法。欢迎在此处留下您的反馈 [这里](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fdiscussions\u002F779)。基于 CausalModel 的旧版 DoWhy API 仍可照常使用。（@andresmor-ms）\n\n* 更快速、更完善的敏感性分析。\n    * 许多反驳方法现支持使用 joblib 进行并行处理，并显示进度条（@astoeffelbauer、@yemaedahrav）。\n    * 非线性敏感性分析 [ [`Chernozhukov, Cinelli, Newey, Sharma & Syrgkanis (2021)`](https:\u002F\u002Farxiv.org\u002Fabs\u002F2112.13398)，[示例笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fsensitivity_analysis_nonparametric_estimators.ipynb) ] (@anusha0409)\n    * E-value 敏感性分析 [ [Ding & Vanderweele (2016)](https:\u002F\u002Fwww.ncbi.nlm.nih.gov\u002Fpmc\u002Farticles\u002FPMC4820664\u002F)，[示例笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fsensitivity_analysis_testing.ipynb)] (@jlgleason)\n\n* 用于 [单位变化归因](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fv0.9\u002Fdowhy.gcm.html#dowhy.gcm.unit_change.unit_change) 的新 API (@kailashbuki)\n\n* 新的质量选项 [`BEST` 用于自动分配](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002Fv0.9\u002Fdowhy.gcm.html#module-dowhy.gcm.auto) 因果机制，该选项使用可选的自动化机器学习库 [AutoGluon](https:\u002F\u002Fauto.gluon.ai\u002F) (@bloebp)\n\n* 通过 [causal-learn](https:\u002F\u002Fgithub.com\u002Fcmu-phil\u002Fcausal-learn) 软件包实现更优的条件独立性检验（@bloebp）\n\n* 用于计算高效后门集的算法 [ [示例笔记本](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_efficient_backdoor_example.ipynb) ] (@esmucler)\n\n* 支持估计受控直接效应（@amit-sharma）\n\n* 支持 econml 估计器处理多值干预措施（@EgorKraevTransferwise）\n\n* 为 [文档](https:\u002F\u002Fwww.pywhy.org\u002Fdowhy\u002F) 采用新的 PyData 主题，包括全新首页、入门指南、修订后的用户指南和示例页面（@petergtz）\n\n* 提供一份 [贡献指南](https:\u002F\u002Fgithub.com\u002Fpy-why\u002Fdowhy\u002Fblob\u002Fmain\u002Fdocs\u002Fsource\u002Fcontributing\u002Fcontributing-code.rst) 以及针对新贡献者的简化说明（@MichaelMarien）\n\n* 使用 Poetry 简化开发环境，以管理依赖关系和项目构建（@darthtrevino）\n\n* 错误修复","2022-12-06T09:17:34",{"id":192,"version":193,"summary_zh":194,"released_at":195},206624,"v0.8","非常感谢 @petergtz、@kailashbuki 和 @bloebp 提供的 GCM 包，以及 @anusha0409 为线性模型实现的部分 R² 敏感性分析。\n\n* **图形因果模型：** 结构因果模型、根本原因分析、归因分析、假设分析等。\n\n* **敏感性分析：** 基于 [Cinelli & Hazlett (2020)](https:\u002F\u002Frss.onlinelibrary.wiley.com\u002Fdoi\u002F10.1111\u002Frssb.12348) 的更快、更通用的线性模型部分 R² 敏感性分析。\n\n* **新的文档结构：** 更新了文档结构，新增用户指南和贡献者指南。请查看[文档](https:\u002F\u002Fpy-why.github.io\u002Fdowhy\u002F)。\n\n* 错误修复\n\n\n贡献者：@amit-sharma、@anusha0409、@bloebp、@EgorKraevTransferwise、@EliKling、@kailashbuki、@itsoum、@MichaelMarien、@petergtz、@ryanrussell","2022-07-18T18:24:37",{"id":197,"version":198,"summary_zh":199,"released_at":200},206625,"v0.7.1","* Graph refuter with conditional independence tests to check whether data conforms to the assumed causal graph\r\n\r\n* Better docs for estimators by adding the method-specific parameters directly in its own init method\r\n* Support use of custom external estimators \r\n* Consistent calls for init_params for dowhy and econml estimators\r\n* Add support for Dagitty graphs\r\n* Bug fixes for GLM model, causal model with no confounders, and hotel case-study notebook\r\n\r\nThank you @EgorKraevTransferwise, @ae-foster, and @anusha0409 for your contributions!","2022-03-20T14:17:50",{"id":202,"version":203,"summary_zh":204,"released_at":205},206626,"v0.7","* **[Major]** Faster backdoor identification with support for minimal adjustment, maximal adjustment\r\n  or exhaustive search. More test coverage for identification.\r\n\r\n* **[Major]** Added new functionality of causal discovery [Experimental].\r\n  DoWhy now supports discovery algorithms from external libraries like CDT.\r\n  [Example notebook](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_causal_discovery_example.ipynb)\r\n\r\n* **[Major]** Implemented ID algorithm for causal identification. [Experimental]\r\n\r\n* Added friendly text-based interpretation for DoWhy's effect estimate.\r\n\r\n* Added a new estimation method, distance matching that relies on a distance\r\n  metrics between inputs.\r\n\r\n* Heuristics to infer default parameters for refuters.\r\n\r\n* Inferring default strata automatically for propensity score stratification.\r\n\r\n* Added support for custom propensity models in propensity-based estimation\r\n  methods.\r\n\r\n* Bug fixes for confidence intervals for linear regression. Better version of\r\n  bootstrap method.\r\n\r\n* Allow effect estimation without need to refit the model for econml estimators\r\n\r\nBig thanks to @AndrewC19, @ha2trinh, @siddhanthaldar, and @vojavocni","2022-01-10T08:50:57",{"id":207,"version":208,"summary_zh":209,"released_at":210},206627,"v0.6","* **[Major]** Placebo refuter now supports instrumental variable methods\r\n* **[Major]** Moved matplotlib to an optional dependency. Can be installed using `pip install dowhy[plotting]`\r\n* **[Major]** A new method for generating unobserved confounder for refutation\r\n* Dummyoutcomerefuter supports unobserved confounder\r\n* Update to align with EconML's new API\r\n* All refuters now support control and treatment values for continuous treatments\r\n* Better logging configuration\r\n\r\n\r\nA big thanks to @arshiaarya, @n8sty, @moprescu and @vojavocni for their contributions!","2021-03-03T03:44:46",{"id":212,"version":213,"summary_zh":214,"released_at":215},206628,"v0.5.1","* Added an optimized version for `identify_effect`\r\n* Fixed a bug for direct and indirect effects computation\r\n* More test coverage: Notebooks are also under automatic tests\r\n* updated conditional-effects-notebook to support the latest EconML version\r\n* EconML metalearners now have the expected behavior: accept both `common_causes` and `effect_modifiers` \r\n* Fixed some bugs in refuter tests","2020-12-12T15:25:38",{"id":217,"version":218,"summary_zh":219,"released_at":220},206629,"v0.5","**Installation**\r\n* DoWhy can be installed on Conda now! \r\n\r\n**Code**\r\n* Support for identification by mediation formula\r\n* Support for the front-door criterion\r\n* Linear estimation methods for mediation\r\n* Generalized backdoor criterion implementation using paths and d-separation\r\n* Added GLM estimators, including logistic regression\r\n* New API for interpreting causal models, estimates and refuters. First interpreter by @ErikHambardzumyan visualizes\r\nhow the distribution of confounder changes\r\n* Friendlier error messages for propensity score stratification estimator when there is not enough data in a bin.\r\n* Enhancements to the dummy outcome refuter with machine learned components--now can simulate non-zero effects too. Ready for alpha testing\r\n\r\n**Docs**\r\n* New case studies using DoWhy on [hotel booking cancellations](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002FDoWhy-The%20Causal%20Story%20Behind%20Hotel%20Booking%20Cancellations.ipynb) and [membership rewards programs](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_example_effect_of_memberrewards_program.ipynb). \r\n* New [notebook](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Fdowhy_multiple_treatments.ipynb) on using DoWhy+EconML for estimating effect of multiple treatments \r\n* A [tutorial](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002Fdocs\u002Fsource\u002Fexample_notebooks\u002Ftutorial-causalinference-machinelearning-using-dowhy-econml.ipynb) on causal inference using dowhy and econml \r\n* Better organization of docs and notebooks on the documentation website (https:\u002F\u002Fmicrosoft.github.io\u002Fdowhy\u002F)\r\n\r\n**Community**\r\n* Created a [contributors page](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fdowhy\u002Fblob\u002Fmaster\u002FCONTRIBUTING.md) with guidelines for contributing\r\n* Added allcontributors bot so that new contributors can added just after their pull requests are merged\r\n\r\nA big thanks to @Tanmay-Kulkarni101, @ErikHambardzumyan, @Sid-darthvader for their contributions. ","2020-11-21T16:15:48",{"id":222,"version":223,"summary_zh":224,"released_at":225},206630,"v0.4","* DummyOutcomeRefuter now includes machine learning functions to increase power of the refutation.\r\n\t* In addition to generating a random dummy outcome, now you can generate a dummyOutcome that is an arbitrary function of confounders but always independent of treatment, and then test whether the estimated treatment effect is zero. This is inspired by ideas from the T-learner.\r\n\t* We also provide default machine learning-based methods to estimate such a dummyOutcome based on confounders. Of course, you can specify any custom ML method.\r\n\r\n* Added a new BootstrapRefuter that simulates the issue of measurement error with confounders. Rather than a simple bootstrap, you can generate bootstrap samples with noise on the values of the confounders and check how sensitive the estimate is.\r\n\t* The refuter supports custom selection of the confounders to add noise to.\r\n\r\n* All refuters now provide confidence intervals and a significance value.\r\n\r\n* Better support for heterogeneous effect libraries like EconML and CausalML\r\n\t* All CausalML methods can be called directly from DoWhy, in addition to all methods from EconML.\r\n\t* [Change to naming scheme for estimators] To achieve a consistent naming scheme for estimators, we suggest to prepend internal dowhy estimators with the string \"dowhy\". For example, \"backdoor.dowhy.propensity_score_matching\". Not a breaking change, so you can keep using the old naming scheme too.\r\n\t* EconML-specific: Since EconML assumes that effect modifiers are a subset of confounders, a warning is issued if a user specifies effect modifiers outside of confounders and tries to use EconML methods.\r\n\r\n* CI and Standard errors: Added bootstrap-based confidence intervals and standard errors for all methods. For linear regression estimator, also implemented the corresponding parametric forms.\r\n\r\n* Convenience functions for getting confidence intervals, standard errors and conditional treatment effects (CATE), that can be called after fitting the estimator if needed\r\n\r\n* Better coverage for tests. Also, tests are now seeded with a random seed, so more dependable tests.\r\n\r\nThanks to @Tanmay-Kulkarni101 and @Arshiaarya  for their contributions!","2020-05-11T15:57:47",{"id":227,"version":228,"summary_zh":229,"released_at":230},206631,"v0.2","This release includes many major updates:\r\n\r\n* (BREAKING CHANGE) The CausalModel import is now simpler: \"from dowhy import CausalModel\"\r\n*  Multivariate treatments are now supported. \r\n*  Conditional Average Treatment Effects (CATE) can be estimated for any subset of the data. Includes integration with EconML--any method from EconML can be called using DoWhy through the estimate_effect method (see example notebook). \r\n*  Other than CATE, specific target estimands like ATT and ATC are also supported for many of the estimation methods.   \r\n* For reproducibility, you can specify a random seed for all refutation methods. \r\n* Multiple bug fixes and updates to the documentation.\r\n\r\n \r\nIncludes contributions from @j-chou, @ktmud, @jrfiedler, @shounak112358, @Lnk2past. Thank you all!","2020-01-08T12:04:34",{"id":232,"version":233,"summary_zh":234,"released_at":235},206632,"v0.1.1-alpha","This release implements the four steps of causal inference: model, identify, estimate and refute. It also includes a pandas.DataFrame extension for causal inference and the do-sampler.","2019-07-15T12:51:28"]