Metadata-Version: 2.4
Name: fastHDMI
Version: 1.25.26
Summary: Use fast FFT-based mutual information screening for large datasets. Works well on MRI brain imaging data. Developed by Kai Yang, [GPG Public key Fingerprint: B9F863A56220DBD56B91C3E835022A1A5941D810](https://keys.openpgp.org/vks/v1/by-fingerprint/B9F863A56220DBD56B91C3E835022A1A5941D810)
Home-page: https://github.com/Kaiyangshi-Ito/fastHDMI
Author: Kai Yang
Author-email: Kai Yang <kai.yang2@mail.mcgill.ca>
License: MIT License
        
        Copyright (c) 2025 Kai Yang
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Kaiyangshi-Ito/fastHDMI
Project-URL: Bug Tracker, https://github.com/Kaiyangshi-Ito/fastHDMI/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.14.2
Requires-Dist: numba>=0.54.1
Requires-Dist: KDEpy>=1.1.12
Requires-Dist: scikit-learn>=1.0.2
Requires-Dist: bed-reader>=1.0.4
Requires-Dist: multiprocess>=0.70.6
Requires-Dist: pandas>=1.4.4
Requires-Dist: dask
Requires-Dist: tqdm>=4.64.1
Requires-Dist: Cython>=0.29.21
Dynamic: author
Dynamic: home-page
Dynamic: license-file

# fastHDMI - Fast High-Dimensional Mutual Information Estimation

## Kai Yang
### Contact: <kai.yang2 "at" mail.mcgill.ca>
### [GPG Public Key Fingerprint: B9F863A56220DBD56B91C3E835022A1A5941D810](https://keys.openpgp.org/vks/v1/by-fingerprint/B9F863A56220DBD56B91C3E835022A1A5941D810)

Fast mutual information estimation for high-dimensional data. See the paper: [***`fastHDMI`: Fast Mutual Information Estimation for High-Dimensional Data***](https://arxiv.org/abs/2410.10082).

## Installation

```bash
pip install fastHDMI
```

## Usage

### Basic MI Estimation
```python
import fastHDMI
import numpy as np

# Generate sample data
x = np.random.randn(1000)
y = x + 0.5 * np.random.randn(1000)

# Estimate MI between continuous variables
mi = fastHDMI.MI_continuous_continuous(x, y, bw_multiplier=1.0)
print(f"MI: {mi}")

# MI between binary and continuous
binary_y = (y > 0).astype(int)
mi_binary = fastHDMI.MI_binary_continuous(binary_y, x, bw_multiplier=1.0)
```

### Feature Screening
```python
# Screen features against continuous outcome
X = np.random.randn(100, 50)  # 100 samples, 50 features
y = X[:, 0] + 0.5 * X[:, 1] + np.random.randn(100) * 0.1

# Single-threaded screening
mi_scores = fastHDMI.continuous_screening_array(X, y)

# Parallel screening (faster for many features)
mi_scores_parallel = fastHDMI.continuous_screening_array_parallel(X, y, core_num=4)

# Find top features
top_features = np.argsort(mi_scores)[-10:]
print(f"Top 10 features: {top_features}")
```

### CSV File Screening
```python
# Screen features from CSV file (outcome in first column)
mi_scores = fastHDMI.continuous_screening_csv_parallel(
    "data.csv",
    core_num=4
)

# Using sklearn MI estimation
mi_scores_sk = fastHDMI.continuous_skMI_screening_csv_parallel(
    "data.csv", 
    n_neighbors=3,
    core_num=4
)

# Pearson correlation screening
correlations = fastHDMI.Pearson_screening_csv_parallel(
    "data.csv",
    core_num=4
)
```

### DataFrame Screening
```python
import pandas as pd

# Create DataFrame with outcome as first column
df = pd.DataFrame(X, columns=[f'feature_{i}' for i in range(50)])
df.insert(0, 'outcome', y)

# Screen using DataFrame
mi_scores = fastHDMI.continuous_screening_dataframe(df)
```

## Package Information

- **PyPI**: [pypi.org/project/fastHDMI](https://pypi.org/project/fastHDMI/)

## ABIDE Data Analysis

- **Data**: [(pre-processed) ABIDE data](http://preprocessed-connectomes-project.org/abide/)
- **Notebook**: [/paper/ABIDE_data_analysis/ABIDE_analysis.ipynb](/paper/ABIDE_data_analysis/ABIDE_analysis.ipynb) - generates scripts for fastHDMI analysis
- **Execution**: Run scripts on server (e.g., Compute Canada), then rerun notebook with results (.npy files) to generate plots

## Computational Resources

- **Resource logs**: `seff-[jobID].out` files show job resource usage
- **Compute Canada docs**: [docs.alliancecan.ca/wiki/Running_jobs](https://docs.alliancecan.ca/wiki/Running_jobs)
