This repository contains python code that implements various estimators of entropy and mutual information.
In particular, Renyi Multi Information and Tsallis Multi Information estimators are available.
## Quickstart
Install `midas` from the Python Package Index by using `pip`, via
```bash
pip install midasML
```
Alternatively, you can clone it from our Github repository with
```bash
$ git clone https://github.com/SheffieldML/midas
```
and then install it with
```bash
$ python setup.py install
```
from the main folder of `midas`.
## Working example
To test `midas`, you can use the following example.
Create a toy dataset specifying the correlation between some variables.
```python
import numpy as np
from midas.estimator import RenyiMutualInformationDivergence, MIDAS
from midas.model_assessment import permutation_test_score_groups
from midas.utils import sample_generation
np.random.seed(30)
n_samples, n_dim = 30, 20
rho_s = [.95, .9, .8, 0, 0]
X, y, feature_names, groups = sample_generation.make_groups_joint(n_samples, n_dim, rho_s=rho_s)
estimator = RenyiMutualInformationDivergence(alpha=0.99, k=3, n_iter=20)
result = permutation_test_score_groups(MIDAS(estimator), X, y, groups, n_jobs=-1)
```
The first 3 groups of features are differentially co-regulated in half of the samples with respect to the other half, while the other groups of features are not (i.e., their co-regulation is the same in the two cases.)
Hence, we can use the `RenyiMutualInformationDivergence` to analyse the co-regulation for different classes of samples, by using `MIDAS` class.
`result` is a `pandas.DataFrame` which contains a summary of the result, which is something like
| | score | perm_scores | p-value | group |
|-----| ------------- |:-------------:| -----:|:-----|
0 | 0.614204 | [0.119599699041, 0.17002017399, 0.000642361597...| 0.009901| [0, 1, 2, 3]
1 | 1.177062 |[0.00106705500132, 0.0115119749325, 0.00023392...| 0.009901 |[4, 5, 6, 7]
2 | 0.223355 |[0.0, 0.0410519694311, 0.00417966412452, 0.007...| 0.029703 |[8, 9, 10, 11]
3 | 0.010378 |[0.00187253953604, 0.00757194385644, 0.0002593...| 0.445545 |[12, 13, 14, 15]
4 | 0.000000 |[0.00307271647955, 0.0, 0.0129193052203, 0.010...| 1.000000 |[16, 17, 18, 19]
The first three results should have an high score and a low p-value, since the first three groups are differentially co-regulated by design (as specified before through the `rho_s` array). Hence, as in the example above, the method is capable to correctly address groups of variables as differentially co-regulated in the two classes of samples.
## Other examples
For other examples, please refer to Jupyter notebooks present in our Github page at
https://github.com/SheffieldML/midas/tree/master/notebooks.
Metadata
Release files for midasML 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| midasML-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for midasML-0.1.0-py2.py3-none-any.whl |
Release files / midasML-0.1.0-py2.py3-none-any.whl
| Download URL | midasML-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6fe8beb75aafdcdba45aa14e5a8197b8fca1d6888ed20d5bda9a7b34c3b4ca74
|
|
BLAKE2b-256 checksum How to use checksums |
d4f794175a7cf6bcb6a610122ffb9a3c59d993151ba77704e4e55ce583270ba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for midasML 0.1.0
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.