pytofi 0.0.1__tar.gz

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.
pytofi-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 aipsylab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pytofi-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytofi
3
+ Version: 0.0.1
4
+ Summary: Tests on Feature Importance
5
+ Author-email: Po-Hsien Huang <psyphh@nccu.edu.tw>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: scikit-learn>=1.5.0
13
+ Requires-Dist: pandas>=2.0.3
14
+ Dynamic: license-file
15
+
16
+ # TOFI: Tests on Feature Importance
17
+
18
+
19
+ ## Overview
20
+
21
+ `tofi` is a python package for conducting tests on feature importance in machine learning. It is written on the basis of [`scikit-learn`](https://scikit-learn.org/stable/index.html). Hence, in principle, any regressor/classifier learned by `scikit-learn` can be inferred by `tofi`.
22
+
23
+ `tofi` provides two types of `Inferer` for making inferences: `CIT` for conditional independence test and `RIT` for risk invariance test. `CIT` can implement the holdout randomization test (HRT; Tansey et al., 2022), residual permutation test (RPT; Huang, 2024), and conditional predictive impact (CPI; Watson & Wright, 2021). On the other hand, `RIT` can conduct leave-one-covariate-out (LOCO; Lei et al., 2018) and plug-in estimation (PIE; Williamson et al., 2023). In addition, `tofi` also constructs a `Crosser` class. With the help of `Crosser`, cross-fitting and $p$-value combination can be easily implemented to improve the stability and even statistical power of the CITs and RITs.
24
+
25
+ ## Installation
26
+ `tofi` can be installed via `pip`:
27
+ ```
28
+ pip install pytofi
29
+ ```
30
+
31
+ ## Tutorial
32
+
33
+ Three Jupyter notebooks are available to learn the use of `sial`:
34
+
35
+ 1. [Conditional Independence Tests](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_1_cit.ipynb)
36
+ 2. [Risk Invariance Tests](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_2_rit.ipynb)
37
+ 3. [Cross-Fitting and $p$-Value Combination](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_3_crosser.ipynb)
38
+
39
+ These notebooks assume that readers have experiences in using `scikit-learn`.
40
+
41
+ ## References
42
+
43
+ Huang, P.-H. (2024). Residual Permutation Tests for Feature Importance in Machine Learning. [Manuscript submitted for publication].
44
+
45
+ Lei, J., G’Sell, M., Rinaldo, A., Tibshirani, R. J., & Wasserman, L. (2018). Distribution-free predictive inference for regression. Journal of the American Statistical Association, 113(523), 1094–1111. doi: 10.1080/01621459.2017.1307116
46
+
47
+ Tansey, W., Veitch, V., Zhang, H., Rabadan, R., & Blei, D. M. (2022). The holdout randomization test for feature selection in black box models. Journal of Computational and Graphical Statistics, 31(1), 151–162. doi: 10.1080/10618600.2021.1923520
48
+
49
+ Watson, D., & Wright, M. (2021). Testing conditional independence in supervised learning algorithms. Machine Learning, 110, 1-23. doi: 10.1007/s10994-021-06030-6
50
+
51
+ Williamson, B. D., Gilbert, P. B., Simon, N. R., & Carone, M. (2023). A general framework for inference on algorithm-agnostic variable importance. Journal of the American Statistical Association, 118(543), 1645–1658. doi: 10.1080/01621459.2021.2003200
pytofi-0.0.1/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # TOFI: Tests on Feature Importance
2
+
3
+
4
+ ## Overview
5
+
6
+ `tofi` is a python package for conducting tests on feature importance in machine learning. It is written on the basis of [`scikit-learn`](https://scikit-learn.org/stable/index.html). Hence, in principle, any regressor/classifier learned by `scikit-learn` can be inferred by `tofi`.
7
+
8
+ `tofi` provides two types of `Inferer` for making inferences: `CIT` for conditional independence test and `RIT` for risk invariance test. `CIT` can implement the holdout randomization test (HRT; Tansey et al., 2022), residual permutation test (RPT; Huang, 2024), and conditional predictive impact (CPI; Watson & Wright, 2021). On the other hand, `RIT` can conduct leave-one-covariate-out (LOCO; Lei et al., 2018) and plug-in estimation (PIE; Williamson et al., 2023). In addition, `tofi` also constructs a `Crosser` class. With the help of `Crosser`, cross-fitting and $p$-value combination can be easily implemented to improve the stability and even statistical power of the CITs and RITs.
9
+
10
+ ## Installation
11
+ `tofi` can be installed via `pip`:
12
+ ```
13
+ pip install pytofi
14
+ ```
15
+
16
+ ## Tutorial
17
+
18
+ Three Jupyter notebooks are available to learn the use of `sial`:
19
+
20
+ 1. [Conditional Independence Tests](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_1_cit.ipynb)
21
+ 2. [Risk Invariance Tests](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_2_rit.ipynb)
22
+ 3. [Cross-Fitting and $p$-Value Combination](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_3_crosser.ipynb)
23
+
24
+ These notebooks assume that readers have experiences in using `scikit-learn`.
25
+
26
+ ## References
27
+
28
+ Huang, P.-H. (2024). Residual Permutation Tests for Feature Importance in Machine Learning. [Manuscript submitted for publication].
29
+
30
+ Lei, J., G’Sell, M., Rinaldo, A., Tibshirani, R. J., & Wasserman, L. (2018). Distribution-free predictive inference for regression. Journal of the American Statistical Association, 113(523), 1094–1111. doi: 10.1080/01621459.2017.1307116
31
+
32
+ Tansey, W., Veitch, V., Zhang, H., Rabadan, R., & Blei, D. M. (2022). The holdout randomization test for feature selection in black box models. Journal of Computational and Graphical Statistics, 31(1), 151–162. doi: 10.1080/10618600.2021.1923520
33
+
34
+ Watson, D., & Wright, M. (2021). Testing conditional independence in supervised learning algorithms. Machine Learning, 110, 1-23. doi: 10.1007/s10994-021-06030-6
35
+
36
+ Williamson, B. D., Gilbert, P. B., Simon, N. R., & Carone, M. (2023). A general framework for inference on algorithm-agnostic variable importance. Journal of the American Statistical Association, 118(543), 1645–1658. doi: 10.1080/01621459.2021.2003200
@@ -0,0 +1,26 @@
1
+ [project]
2
+
3
+ name = "pytofi"
4
+
5
+ version = "0.0.1"
6
+
7
+ authors = [
8
+ { name="Po-Hsien Huang", email="psyphh@nccu.edu.tw" },
9
+ ]
10
+
11
+ description = "Tests on Feature Importance"
12
+
13
+ readme = "README.md"
14
+
15
+ dependencies = [
16
+ "scikit-learn>=1.5.0",
17
+ "pandas>=2.0.3",
18
+ ]
19
+
20
+ requires-python = ">=3.9"
21
+
22
+ classifiers = [
23
+ "Programming Language :: Python :: 3",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Operating System :: OS Independent",
26
+ ]
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytofi
3
+ Version: 0.0.1
4
+ Summary: Tests on Feature Importance
5
+ Author-email: Po-Hsien Huang <psyphh@nccu.edu.tw>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: scikit-learn>=1.5.0
13
+ Requires-Dist: pandas>=2.0.3
14
+ Dynamic: license-file
15
+
16
+ # TOFI: Tests on Feature Importance
17
+
18
+
19
+ ## Overview
20
+
21
+ `tofi` is a python package for conducting tests on feature importance in machine learning. It is written on the basis of [`scikit-learn`](https://scikit-learn.org/stable/index.html). Hence, in principle, any regressor/classifier learned by `scikit-learn` can be inferred by `tofi`.
22
+
23
+ `tofi` provides two types of `Inferer` for making inferences: `CIT` for conditional independence test and `RIT` for risk invariance test. `CIT` can implement the holdout randomization test (HRT; Tansey et al., 2022), residual permutation test (RPT; Huang, 2024), and conditional predictive impact (CPI; Watson & Wright, 2021). On the other hand, `RIT` can conduct leave-one-covariate-out (LOCO; Lei et al., 2018) and plug-in estimation (PIE; Williamson et al., 2023). In addition, `tofi` also constructs a `Crosser` class. With the help of `Crosser`, cross-fitting and $p$-value combination can be easily implemented to improve the stability and even statistical power of the CITs and RITs.
24
+
25
+ ## Installation
26
+ `tofi` can be installed via `pip`:
27
+ ```
28
+ pip install pytofi
29
+ ```
30
+
31
+ ## Tutorial
32
+
33
+ Three Jupyter notebooks are available to learn the use of `sial`:
34
+
35
+ 1. [Conditional Independence Tests](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_1_cit.ipynb)
36
+ 2. [Risk Invariance Tests](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_2_rit.ipynb)
37
+ 3. [Cross-Fitting and $p$-Value Combination](https://github.com/aipsylab/tofi/blob/main/tutorial/tutorial_3_crosser.ipynb)
38
+
39
+ These notebooks assume that readers have experiences in using `scikit-learn`.
40
+
41
+ ## References
42
+
43
+ Huang, P.-H. (2024). Residual Permutation Tests for Feature Importance in Machine Learning. [Manuscript submitted for publication].
44
+
45
+ Lei, J., G’Sell, M., Rinaldo, A., Tibshirani, R. J., & Wasserman, L. (2018). Distribution-free predictive inference for regression. Journal of the American Statistical Association, 113(523), 1094–1111. doi: 10.1080/01621459.2017.1307116
46
+
47
+ Tansey, W., Veitch, V., Zhang, H., Rabadan, R., & Blei, D. M. (2022). The holdout randomization test for feature selection in black box models. Journal of Computational and Graphical Statistics, 31(1), 151–162. doi: 10.1080/10618600.2021.1923520
48
+
49
+ Watson, D., & Wright, M. (2021). Testing conditional independence in supervised learning algorithms. Machine Learning, 110, 1-23. doi: 10.1007/s10994-021-06030-6
50
+
51
+ Williamson, B. D., Gilbert, P. B., Simon, N. R., & Carone, M. (2023). A general framework for inference on algorithm-agnostic variable importance. Journal of the American Statistical Association, 118(543), 1645–1658. doi: 10.1080/01621459.2021.2003200
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ pytofi.egg-info/PKG-INFO
5
+ pytofi.egg-info/SOURCES.txt
6
+ pytofi.egg-info/dependency_links.txt
7
+ pytofi.egg-info/requires.txt
8
+ pytofi.egg-info/top_level.txt
9
+ tofi/__init__.py
10
+ tofi/crosser.py
11
+ tofi/inferer.py
12
+ tofi/utils.py
@@ -0,0 +1,2 @@
1
+ scikit-learn>=1.5.0
2
+ pandas>=2.0.3
@@ -0,0 +1 @@
1
+ tofi
pytofi-0.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ from .crosser import Crosser
2
+ from .inferer import CIT, RIT
3
+
4
+ __all__ = ["Crosser",
5
+ "CIT",
6
+ "RIT"]