pycit
Framework for independence testing and conditional independence testing, with multiprocessing. Currently uses mutual information (MI) and conditional mutual information (CMI) as test statistics, estimated using k-NN methods. Also supports a routine for Markov blanket feature selection. Reports permutation-based p-values.
Installation
pip install pycit
Available Test Statistic Estimators
Mutual Information Estimators
ksg_mi: k-NN estimator for continuous databi_ksg_mi: "bias-improved" k-NN estimator for continuous datamixed_mi: k-NN estimator for discrete-continuous mixtures
Conditional Mutual Information Estimators
ksg_cmi: k-NN estimator for continuous databi_ksg_cmi: "bias-improved" k-NN estimator for continuous datamixed_cmi: k-NN estimator for discrete-continuous mixtures
Note: Also includes a differential entropy estimator: kl_entropy.
Example Usage
Independence Testing
from pycit import itest
# Test whether or not x and y are independent
pval = itest(x, y, test_args={'statistic': 'ksg_mi', 'n_jobs': 2})
is_independent = (pval >= 1.- confidence_level)
Conditional Independence Testing
from pycit import citest
# Test whether or not x and y are conditionally independent given z
pval = citest(x, y, z, test_args={'statistic': 'ksg_mi', 'n_jobs': 2})
is_conditionally_independent = (pval >= 1.- confidence_level)
Markov Blanket Feature Selection
from pycit.markov_blanket import MarkovBlanket
# specify CI test configuration
cit_funcs = {
'it_args': {
'test_args': {
'statistic': 'ksg_mi',
'n_jobs': 2
}
},
'cit_args': {
'test_args': {
'statistic': 'ksg_cmi',
'n_jobs': 2
}
}
}
# find Markov blanket of Y. x_data contains data from predictor variables, X_1,...,X_m
mb = MarkovBlanket(x_data, y_data, cit_funcs)
markov_blanket = mb.find_markov_blanket()
Dependencies:
numpyscipyscikit-learn
References:
- Kozachenko, L. and Leonenko, N. (1987). Sample estimate of the entropy of a random vector. Problemy Peredachi Informatsii, 23(2):9–16.
- Kraskov, A., Stögbauer, H., and Grassberger, P. (2004). Estimating mutual information. Physical Review E, 69(6):066138.
- Frenzel, S. and Pompe, B. (2007). Partial mutual information for coupling analysis of multivariate time series. Physical Review Letters, 99(20):204101.
- Gao, W., Kannan, S., Oh, S., and Viswanath, P. (2017). Estimating mutual information for discrete-continuous mixtures. In NIPS'2017.
- Gao, W., Oh, S., and Viswanath, P. (2018). Demystifying fixed k-nearest neighbor information estimators. IEEE Transactions on Information Theory, 64(8):5629–5661.
- Runge, J. (2018). Conditional independence testing based on a nearest-neighbor estimator of conditional mutual information. In AISTATS'18.
- Yang, A., Ghassami, A., Raginsky, M., Kiyavash, N., and Rosenbaum, E. (2020). Model-Augmented Estimation of Conditional Mutual Information for Feature Selection. In UAI'2020.
Metadata
Release files for pycit 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycit-0.0.7.tar.gz | 11.2 kB | Without provenance | Details for pycit-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycit-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for pycit-0.0.7-py3-none-any.whl |
Total release size: 29.9 kB
Release files / pycit-0.0.7.tar.gz
| Download URL | pycit-0.0.7.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c70f24784262e2c4d586719c0f3f0c6736de06fd7f12d804c995a560253f6155
|
|
BLAKE2b-256 checksum How to use checksums |
353665d50566dc7caa78bc054d44eb9fb56f0bd8f189bc2c88d42fd1fc75cf7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.4
|
Release files / pycit-0.0.7-py3-none-any.whl
| Download URL | pycit-0.0.7-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec6a55158312cfd10ad865a07e4c5a34833f35f56a9420c85a7c79a751332cdd
|
|
BLAKE2b-256 checksum How to use checksums |
019072f3126d8d9b472b1a04f9ad26dd0968b6ef4486f03e50c558f7b6dad008
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.4
|
Security for pycit 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.