大家好,又见面了,我是你们的朋友全栈君。
文章目录
-
- CausalDiscoveryToolbox简介
- 因果建模的过程
-
- 图恢复算法 Graph recovery algorithms
-
- 二元依赖 (Bivariate dependencies)
- 多元方法 (Multivariate methods)
- 因果发现算法 Causal Discovery algorithms
-
- 成对建模(The pairwise setting)
- 全图建模(The graph setting)
- 安装Cdt工具包
- 使用示例
- 工具包模块
- 使用感想
最近在分析观测数据的因果关系时,发现一个很好用的工具包——CausalDiscoveryToolbox(以下简称Cdt),功能齐全,轻松上手因果发现。 下面简单整理下该工具包的原理 用法。
CausalDiscoveryToolbox简介
[Github] [论文] [文档]
- 用于在从数据的联合概率分布样本中学习因果图和相关的因果机制。
- 实现了端到端的因果发现方法,支持从观测数据中恢复直接依赖关系(因果图的骨架)和变量之间的因果关系。
- 实现了许多用于图结构恢复的算法(包括来自bnlearn1,pcalg2包的算法)。
- 基于Numpy,Scikit-learn,Pytorch和R开发。
- 支持GPU硬件加速。
因果建模的过程
Cdt工具包对一般的因果建模流程进行了概括:
#mermaid-svg-OH6QleDehJ64NK3r .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-OH6QleDehJ64NK3r .label text{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .node rect,#mermaid-svg-OH6QleDehJ64NK3r .node circle,#mermaid-svg-OH6QleDehJ64NK3r .node ellipse,#mermaid-svg-OH6QleDehJ64NK3r .node polygon,#mermaid-svg-OH6QleDehJ64NK3r .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-OH6QleDehJ64NK3r .node .label{text-align:center;fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .node.clickable{cursor:pointer}#mermaid-svg-OH6QleDehJ64NK3r .arrowheadPath{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-OH6QleDehJ64NK3r .flowchart-link{stroke:#333;fill:none}#mermaid-svg-OH6QleDehJ64NK3r .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-OH6QleDehJ64NK3r .edgeLabel rect{opacity:0.9}#mermaid-svg-OH6QleDehJ64NK3r .edgeLabel span{color:#333}#mermaid-svg-OH6QleDehJ64NK3r .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-OH6QleDehJ64NK3r .cluster text{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-OH6QleDehJ64NK3r .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-OH6QleDehJ64NK3r text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-OH6QleDehJ64NK3r .actor-line{stroke:grey}#mermaid-svg-OH6QleDehJ64NK3r .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-OH6QleDehJ64NK3r .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-OH6QleDehJ64NK3r #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-OH6QleDehJ64NK3r .sequenceNumber{fill:#fff}#mermaid-svg-OH6QleDehJ64NK3r #sequencenumber{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r #crosshead path{fill:#333;stroke:#333}#mermaid-svg-OH6QleDehJ64NK3r .messageText{fill:#333;stroke:#333}#mermaid-svg-OH6QleDehJ64NK3r .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-OH6QleDehJ64NK3r .labelText,#mermaid-svg-OH6QleDehJ64NK3r .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-OH6QleDehJ64NK3r .loopText,#mermaid-svg-OH6QleDehJ64NK3r .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-OH6QleDehJ64NK3r .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-OH6QleDehJ64NK3r .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-OH6QleDehJ64NK3r .noteText,#mermaid-svg-OH6QleDehJ64NK3r .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-OH6QleDehJ64NK3r .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-OH6QleDehJ64NK3r .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-OH6QleDehJ64NK3r .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-OH6QleDehJ64NK3r .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .section{stroke:none;opacity:0.2}#mermaid-svg-OH6QleDehJ64NK3r .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-OH6QleDehJ64NK3r .section2{fill:#fff400}#mermaid-svg-OH6QleDehJ64NK3r .section1,#mermaid-svg-OH6QleDehJ64NK3r .section3{fill:#fff;opacity:0.2}#mermaid-svg-OH6QleDehJ64NK3r .sectionTitle0{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .sectionTitle1{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .sectionTitle2{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .sectionTitle3{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-OH6QleDehJ64NK3r .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .grid path{stroke-width:0}#mermaid-svg-OH6QleDehJ64NK3r .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-OH6QleDehJ64NK3r .task{stroke-width:2}#mermaid-svg-OH6QleDehJ64NK3r .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .taskText:not([font-size]){font-size:11px}#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-OH6QleDehJ64NK3r .task.clickable{cursor:pointer}#mermaid-svg-OH6QleDehJ64NK3r .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-OH6QleDehJ64NK3r .taskText0,#mermaid-svg-OH6QleDehJ64NK3r .taskText1,#mermaid-svg-OH6QleDehJ64NK3r .taskText2,#mermaid-svg-OH6QleDehJ64NK3r .taskText3{fill:#fff}#mermaid-svg-OH6QleDehJ64NK3r .task0,#mermaid-svg-OH6QleDehJ64NK3r .task1,#mermaid-svg-OH6QleDehJ64NK3r .task2,#mermaid-svg-OH6QleDehJ64NK3r .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutside0,#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutside2{fill:#000}#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutside1,#mermaid-svg-OH6QleDehJ64NK3r .taskTextOutside3{fill:#000}#mermaid-svg-OH6QleDehJ64NK3r .active0,#mermaid-svg-OH6QleDehJ64NK3r .active1,#mermaid-svg-OH6QleDehJ64NK3r .active2,#mermaid-svg-OH6QleDehJ64NK3r .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-OH6QleDehJ64NK3r .activeText0,#mermaid-svg-OH6QleDehJ64NK3r .activeText1,#mermaid-svg-OH6QleDehJ64NK3r .activeText2,#mermaid-svg-OH6QleDehJ64NK3r .activeText3{fill:#000 !important}#mermaid-svg-OH6QleDehJ64NK3r .done0,#mermaid-svg-OH6QleDehJ64NK3r .done1,#mermaid-svg-OH6QleDehJ64NK3r .done2,#mermaid-svg-OH6QleDehJ64NK3r .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-OH6QleDehJ64NK3r .doneText0,#mermaid-svg-OH6QleDehJ64NK3r .doneText1,#mermaid-svg-OH6QleDehJ64NK3r .doneText2,#mermaid-svg-OH6QleDehJ64NK3r .doneText3{fill:#000 !important}#mermaid-svg-OH6QleDehJ64NK3r .crit0,#mermaid-svg-OH6QleDehJ64NK3r .crit1,#mermaid-svg-OH6QleDehJ64NK3r .crit2,#mermaid-svg-OH6QleDehJ64NK3r .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-OH6QleDehJ64NK3r .activeCrit0,#mermaid-svg-OH6QleDehJ64NK3r .activeCrit1,#mermaid-svg-OH6QleDehJ64NK3r .activeCrit2,#mermaid-svg-OH6QleDehJ64NK3r .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-OH6QleDehJ64NK3r .doneCrit0,#mermaid-svg-OH6QleDehJ64NK3r .doneCrit1,#mermaid-svg-OH6QleDehJ64NK3r .doneCrit2,#mermaid-svg-OH6QleDehJ64NK3r .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-OH6QleDehJ64NK3r .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-OH6QleDehJ64NK3r .milestoneText{font-style:italic}#mermaid-svg-OH6QleDehJ64NK3r .doneCritText0,#mermaid-svg-OH6QleDehJ64NK3r .doneCritText1,#mermaid-svg-OH6QleDehJ64NK3r .doneCritText2,#mermaid-svg-OH6QleDehJ64NK3r .doneCritText3{fill:#000 !important}#mermaid-svg-OH6QleDehJ64NK3r .activeCritText0,#mermaid-svg-OH6QleDehJ64NK3r .activeCritText1,#mermaid-svg-OH6QleDehJ64NK3r .activeCritText2,#mermaid-svg-OH6QleDehJ64NK3r .activeCritText3{fill:#000 !important}#mermaid-svg-OH6QleDehJ64NK3r .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-OH6QleDehJ64NK3r g.classGroup text .title{font-weight:bolder}#mermaid-svg-OH6QleDehJ64NK3r g.clickable{cursor:pointer}#mermaid-svg-OH6QleDehJ64NK3r g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-OH6QleDehJ64NK3r g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-OH6QleDehJ64NK3r .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-OH6QleDehJ64NK3r .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-OH6QleDehJ64NK3r .dashed-line{stroke-dasharray:3}#mermaid-svg-OH6QleDehJ64NK3r #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r .commit-id,#mermaid-svg-OH6QleDehJ64NK3r .commit-msg,#mermaid-svg-OH6QleDehJ64NK3r .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-OH6QleDehJ64NK3r g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-OH6QleDehJ64NK3r g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-OH6QleDehJ64NK3r g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-OH6QleDehJ64NK3r .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-OH6QleDehJ64NK3r .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-OH6QleDehJ64NK3r .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-OH6QleDehJ64NK3r .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-OH6QleDehJ64NK3r .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-OH6QleDehJ64NK3r .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-OH6QleDehJ64NK3r .edgeLabel text{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-OH6QleDehJ64NK3r .node circle.state-start{fill:black;stroke:black}#mermaid-svg-OH6QleDehJ64NK3r .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-OH6QleDehJ64NK3r #statediagram-barbEnd{fill:#9370db}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-state .divider{stroke:#9370db}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-OH6QleDehJ64NK3r .note-edge{stroke-dasharray:5}#mermaid-svg-OH6QleDehJ64NK3r .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family:'"trebuchet ms", verdana, arial';--mermaid-font-family:"Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-OH6QleDehJ64NK3r .error-icon{fill:#522}#mermaid-svg-OH6QleDehJ64NK3r .error-text{fill:#522;stroke:#522}#mermaid-svg-OH6QleDehJ64NK3r .edge-thickness-normal{stroke-width:2px}#mermaid-svg-OH6QleDehJ64NK3r .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-OH6QleDehJ64NK3r .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-OH6QleDehJ64NK3r .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-OH6QleDehJ64NK3r .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-OH6QleDehJ64NK3r .marker{fill:#333}#mermaid-svg-OH6QleDehJ64NK3r .marker.cross{stroke:#333}</p> <p>:root{--mermaid-font-family:"trebuchet ms", verdana, arial;}#mermaid-svg-OH6QleDehJ64NK3r{color:rgba(0, 0, 0, 0.75);font:;}
观测数据
因果发现算法
图恢复算法
无向图
因果有向图
Cdt工具包可以直接从观测数据中进行因果发现(获得因果有向图),也可以先恢复图结构(获得无向依赖图)之后,再进行因果发现(获得因果有向图)。
图恢复算法 Graph recovery algorithms
在Cdt工具包中实现了两种从原始数据中恢复无向依赖图的方法:
- 二元依赖 (Bivariate dependencies)
- 用于确定因果图中的(无向)边。
- 依赖于统计检验,例如皮尔逊相关性(Pearson’s correlation)或互信息分数(mutual information scores)3。在第一阶段中可以使用二元依赖关系来建立因果图骨架。
- 多元方法 (Multivariate methods)
- 目的是恢复全因果图。即为图的所有变量选择父、子和配偶节点(子的父母)。
- 输出一个networkx.Graph图对象。
因果发现算法 Causal Discovery algorithms
Cdt包的主要焦点是从观测数据中发现因果关系,从成对设置到全图建模。
- 成对建模(The pairwise setting)
- 把每一对变量作为因果对问题(CEP4,cause-effect pair problem)进行处理,从而确定这些变量之间的因果关系。 比如识别X→Y还是Y→X,或者X与Y没有关系。因果对参考教程
- 成对建模的两个经典方法:加性噪声模型(ANM)5和IGCI6 (Information-Geometric Causal Inference),在有篇因果对的综述里有详细介绍,后面有空梳理下。
- 成对建模的前提假设是:这两个变量已经受到其他协变量的制约,并且剩余的潜在协变量几乎没有影响,可以被认为是“噪声”。
- 全图建模(The graph setting)
- 基于贝叶斯或基于分数的方法,输出有向无环图或部分有向无环图。
- ①依赖于条件独立性测试,称为基于约束的方法,如PC7或FCI8。
- ②依赖于基于分数的方法,通过图搜索启发式方法(如GES9或CAM10)找到使似然分数最大化的图。
- ③利用著名的对抗生成网络,例如CGNN11或SAM12。
安装Cdt工具包
直接使用pip安装:
代码语言:javascript复制pip install cdt
使用示例
代码语言:javascript复制import cdt
from cdt import SETTINGS
SETTINGS.verbose=True
#SETTINGS.NJOBS=16
#SETTINGS.GPU=1
import networkx as nx
import matplotlib.pyplot as plt
plt.axis('off')
# Load data
data = pd.read_csv("lucas0_train.csv")
print(data.head())
# Finding the structure of the graph
glasso = cdt.independence.graph.Glasso()
skeleton = glasso.predict(data)
# Pairwise setting
model = cdt.causality.pairwise.ANM()
output_graph = model.predict(data, skeleton)
# Visualize causality graph
options = {
"node_color": "#A0CBE2",
"width": 1,
"node_size":400,
"edge_cmap": plt.cm.Blues,
"with_labels": True,
}
nx.draw_networkx(output_graph,**options)
上述代码输出的因果图:
示例数据: https://download.csdn.net/download/Bit_Coders/16241408
网络结构的绘制参考networkx文档: https://networkx.org/documentation/stable/index.html
工具包模块
该软件包分为5个模块:
- 因果关系:cdt.causality在成对设置或图形设置中实施因果发现算法。
- 独立性:cdt.independence包括恢复数据依赖关系图的方法。
- 数据:cdt.data为用户提供生成数据和加载基准数据的工具。
- 实用程序:cdt.utils为用户提供用于模型构建,图形实用程序和设置的工具。
- 指标:cdt.metrics包括图表的评分指标,以输入为准 networkx.DiGraph 用于计算的所有方法,接口与Scikit-learn类似,在这里.predict() 发动对给定的数据到工具箱中的算法,.fit()使得训练学习算法大部分的算法是类,它们的参数可以在自定义.init()中设置。
程序包及其算法的结构:
代码语言:javascript复制 cdt package
|
|- independence
| |- graph (Infering the skeleton from data)
| | |- Lasso variants (Randomized Lasso[1], Glasso[2], HSICLasso[3])
| | |- FSGNN (CGNN[12] variant for feature selection)
| | |- Skeleton recovery using feature selection algorithms (RFECV[5], LinearSVR[6], RRelief[7], ARD[8,9], DecisionTree)
| |
| |- stats (pairwise methods for dependency)
| |- Correlation (Pearson, Spearman, KendallTau)
| |- Kernel based (NormalizedHSIC[10])
| |- Mutual information based (MIRegression, Adjusted Mutual Information[11], Normalized mutual information[11])
|
|- data
| |- CausalPairGenerator (Generate causal pairs)
| |- AcyclicGraphGenerator (Generate FCM-based graphs)
| |- load_dataset (load standard benchmark datasets)
|
|- causality
| |- graph (methods for graph inference)
| | |- CGNN[12]
| | |- PC[13]
| | |- GES[13]
| | |- GIES[13]
| | |- LiNGAM[13]
| | |- CAM[13]
| | |- GS[23]
| | |- IAMB[24]
| | |- MMPC[25]
| | |- SAM[26]
| | |- CCDr[27]
| |
| |- pairwise (methods for pairwise inference)
| |- ANM[14] (Additive Noise Model)
| |- IGCI[15] (Information Geometric Causal Inference)
| |- RCC[16] (Randomized Causation Coefficient)
| |- NCC[17] (Neural Causation Coefficient)
| |- GNN[12] (Generative Neural Network -- Part of CGNN )
| |- Bivariate fit (Baseline method of regression)
| |- Jarfo[20]
| |- CDS[20]
| |- RECI[28]
|
|- metrics (Implements the metrics for graph scoring)
| |- Precision Recall
| |- SHD
| |- SID [29]
|
|- utils
|- Settings -> SETTINGS class (hardware settings)
|- loss -> MMD loss [21, 22] & various other loss functions
|- io -> for importing data formats
|- graph -> graph utilities
使用感想
- 接口简单,文档清晰,易于上手。
- 不过目前还不支持使用干预措施。
- Cdt工具包是在观察环境进行因果发现的软件包,所以相当于还是在因果科学的第一层级“关联”。不过从当前的实际应用角度来说,“干预”和“反事实”的实施难度较大,“关联”层级的因果发现和推理已经能起到一定的作用。
- Marco Scutari. Package ‘bnlearn’, 2018. ↩︎
- Markus Kalisch, Alain Hauser, et al. Package ‘pcalg’. 2018. ↩︎
- Nguyen Xuan Vinh, Julien Epps, and James Bailey. Information theoretic measures for clusterings comparison: Variants, properties, normalization and correction for chance. Journal of Machine Learning Research, 11(Oct):2837–2854, 2010. ↩︎
- Isabelle Guyon. Chalearn cause effect pairs challenge, 2013. URL http://www.causality.inf.ethz.ch/cause-effect.php. ↩︎
- Patrik O Hoyer, Dominik Janzing, Joris M Mooij, Jonas Peters, and Bernhard Sch¨olkopf. Nonlinear causal discovery with additive noise models. In Neural Information Processing Systems (NIPS), pages 689–696, 2009. ↩︎
- Janzing, D., Mooij, J., Zhang, K., Lemeire, et al… (2012). Information-geometric approach to inferring causal directions. Artificial Intelligence, 182, 1-31. ↩︎
- Peter Spirtes, Clark N Glymour, and Richard Scheines. Causation, prediction, and search.MIT press, 2000 ↩︎
- Eric V Strobl, Kun Zhang, and Shyam Visweswaran. Approximate kernel-based conditional independence tests for fast non-parametric causal discovery. 2017 ↩︎
- David Maxwell Chickering. Optimal structure identification with greedy search. Journal of machine learning research, 3(Nov):507–554, 2002. ↩︎
- Peter B¨uhlmann, Jonas Peters, Jan Ernest, et al. Cam: Causal additive models, highdimensional order search and penalized regression. The Annals of Statistics, 2014. ↩︎
- Olivier Goudet, Diviyan Kalainathan, et al. Learning functional causal models with generative neural networks. 2017. ↩︎
- Diviyan Kalainathan, Olivier Goudet, et al. Sam: Structural agnostic model, causal discovery and penalized adversarial learning. 2018. ↩︎
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/170417.html原文链接:https://javaforall.cn