fast-causal-shap 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fast-causal-shap might be problematic. Click here for more details.

@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: fast-causal-shap
3
+ Version: 0.1.2
4
+ Summary: A Python package for efficient causal SHAP computations
5
+ Author-email: woonyee28 <ngnwy289@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/woonyee28/CausalSHAP
8
+ Project-URL: Issues, https://github.com/woonyee28/CausalSHAP/issues
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: pandas>=1.0.0
13
+ Requires-Dist: networkx>=2.0
14
+ Requires-Dist: numpy>=1.18.0
15
+ Requires-Dist: scikit-learn>=0.24.0
16
+ Dynamic: license-file
17
+
18
+ # Fast Causal SHAP
19
+
20
+ Fast Causal SHAP is a Python package designed for efficient and interpretable SHAP value computation in causal inference tasks. It integrates seamlessly with various causal inference frameworks and enables feature attribution with awareness of causal dependencies.
21
+
22
+ ## Features
23
+
24
+ - Fast computation of SHAP values for causal models
25
+ - Support for multiple causal inference frameworks
26
+
27
+ ## Installation
28
+
29
+ Install the stable version via PyPI:
30
+
31
+ ```bash
32
+ pip install fast-causal-shap
33
+ ```
34
+
35
+ Or, for the latest development version:
36
+
37
+ ```bash
38
+ pip install git+https://github.com/woonyee28/CausalSHAP.git
39
+ ```
40
+
41
+ ## Usage
42
+ ```
43
+ from fast_causal_shap.core import FastCausalSHAP
44
+
45
+ # Predict probabilities and assign to training data
46
+ predicted_probabilities = model.predict_proba(X_train)[:,1]
47
+ X_train['target'] = predicted_probabilities
48
+
49
+ # Initialize FastCausalInference
50
+ ci = FastCausalInference(data=X_train, model=model, target_variable='target')
51
+
52
+ # Load causal strengths (precomputed using R packages)
53
+ ci.load_causal_strengths(result_dir + 'Causal_Effect.json')
54
+
55
+ # Compute modified SHAP values for a single instance
56
+ x_instance = X_train.iloc[33]
57
+
58
+ print(ci.compute_modified_shap_proba(x_instance, is_classifier=True))
59
+ ```
60
+
61
+ Format of the Causal_Effect.json:
62
+ ```
63
+ [
64
+ {
65
+ "Pair": "Bacteroidia->Clostridia",
66
+ "Mean_Causal_Effect": 0.71292
67
+ },
68
+ {
69
+ "Pair": "Clostridia->Alphaproteobacteria",
70
+ "Mean_Causal_Effect": 0.37652
71
+ }, ......
72
+ ]
73
+ ```
74
+
75
+ Fast Causal SHAP supports integration with structural algorithms such as:
76
+ 1. Peter-Clarke (PC) Algorithm
77
+ 2. IDA Algorithm
78
+ 3. Fast Causal Inference (FCI) Algorithm
79
+ You can find example R code for these integrations here: [FastCausalSHAP R code examples](https://github.com/woonyee28/CausalSHAP/tree/main/code/r)
80
+
81
+
82
+ ## Citation
83
+ If you use Fast Causal SHAP in your research, please cite:
84
+ ```
85
+ @inproceedings{ng2025causal,
86
+ title={Causal SHAP: Feature Attribution with Dependency Awareness through Causal Discovery},
87
+ author={Ng, Woon Yee and Wang, Li Rong and Liu, Siyuan and Fan, Xiuyi},
88
+ booktitle={Proceedings of the International Joint Conference on Neural Networks (IJCNN)},
89
+ year={2025},
90
+ organization={IEEE}
91
+ }
92
+ ```
93
+
94
+ ## License
95
+
96
+ This project is licensed under the MIT License.
@@ -0,0 +1,7 @@
1
+ fast_causal_shap/__init__.py,sha256=d1piIUSJI81MVDdqtqzdteGKWO1ShUP0KUoqD8CoZa4,226
2
+ fast_causal_shap/core.py,sha256=9FSFdPLV5TCQIW8p2Bu8W4icZjvNb5MnQOdDkOQHCTM,12505
3
+ fast_causal_shap-0.1.2.dist-info/licenses/LICENSE,sha256=pAZXnNE2dxxwXFIduGyn1gpvPefJtUYOYZOi3yeGG94,1068
4
+ fast_causal_shap-0.1.2.dist-info/METADATA,sha256=QhCik5sM_Sng_YXDnabuDKAf6Akt46th_dqqo2wR44Q,2796
5
+ fast_causal_shap-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ fast_causal_shap-0.1.2.dist-info/top_level.txt,sha256=nAIqoFfVB4g6cJal-o9z4LmDYIX1lj1x15oJrlsT_4E,17
7
+ fast_causal_shap-0.1.2.dist-info/RECORD,,
@@ -1,50 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fast-causal-shap
3
- Version: 0.1.0
4
- Summary: A Python package for efficient causal SHAP computations
5
- Author-email: woonyee28 <ngnwy289@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/woonyee28/CausalSHAP
8
- Project-URL: Issues, https://github.com/woonyee28/CausalSHAP/issues
9
- Requires-Python: >=3.7
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: pandas>=1.0.0
13
- Requires-Dist: networkx>=2.0
14
- Requires-Dist: numpy>=1.18.0
15
- Requires-Dist: scikit-learn>=0.24.0
16
- Dynamic: license-file
17
-
18
- # Fast Causal SHAP
19
-
20
- This folder contains the core modules and components for the **Fast Causal SHAP** Python package. Fast Causal SHAP provides efficient and interpretable SHAP value computation for causal inference tasks.
21
-
22
- ## Features
23
-
24
- - Fast computation of SHAP values for causal models
25
- - Support for multiple causal inference frameworks
26
-
27
- ## Installation
28
-
29
- Install Fast Causal SHAP using pip:
30
-
31
- ```bash
32
- pip install fast-causal-shap
33
- ```
34
-
35
- Or, for the latest development version:
36
-
37
- ```bash
38
- pip install git+https://github.com/woonyee28/CausalSHAP.git
39
- ```
40
-
41
- ## Usage
42
- // To be added
43
-
44
- ## Citation
45
- If you use this package in your research, please cite:
46
- // To be added
47
-
48
- ## License
49
-
50
- This project is licensed under the MIT License.
@@ -1,7 +0,0 @@
1
- fast_causal_shap/__init__.py,sha256=d1piIUSJI81MVDdqtqzdteGKWO1ShUP0KUoqD8CoZa4,226
2
- fast_causal_shap/core.py,sha256=9FSFdPLV5TCQIW8p2Bu8W4icZjvNb5MnQOdDkOQHCTM,12505
3
- fast_causal_shap-0.1.0.dist-info/licenses/LICENSE,sha256=pAZXnNE2dxxwXFIduGyn1gpvPefJtUYOYZOi3yeGG94,1068
4
- fast_causal_shap-0.1.0.dist-info/METADATA,sha256=g97MKoflaX8Wy_3jIKxPmZ5ZSLvNcyqrse8XvR6y7Iw,1264
5
- fast_causal_shap-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- fast_causal_shap-0.1.0.dist-info/top_level.txt,sha256=nAIqoFfVB4g6cJal-o9z4LmDYIX1lj1x15oJrlsT_4E,17
7
- fast_causal_shap-0.1.0.dist-info/RECORD,,