Torch - Higher Order Interactions
Project description
THOI: Torch - Higher Order Interactions
Description
THOI is a Python package designed to compute O information in Higher Order Interactions using batch processing. This package leverages PyTorch for efficient tensor operations.
Installation
Prerequisites
Ensure you have Python 3.6 or higher installed.
Installing THOI with your prefered Versions of PyTorch
Because PyTorch installation can depend on the user environment and requirements (GPU or CPU support or a specific version of PyTorch), you need to install PyTorch separately before installing THOI. Follow these steps:
-
Visit the official PyTorch installation guide:
- Go to the PyTorch website and navigate to the "Get Started" page.
- Select your preferences for the following options:
- PyTorch Build: Stable or LTS (long-term support)
- Your Operating System: Linux, Mac, or Windows
- Package: Pip (recommended)
- Language: Python
- Compute Platform: CPU, CUDA 10.2, CUDA 11.1, etc.
-
Get the Installation Command:
-
Based on your selections, the PyTorch website will provide the appropriate installation command.
-
For example, for the CPU-only version, the command will look like this:
pip install torch==1.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
-
For the GPU version with CUDA 11.1, the command will look like this:
pip install torch==1.8.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
-
-
Install PyTorch:
- Copy and run the command provided by the PyTorch website in your terminal.
-
Install THOI:
-
Once PyTorch is installed, install THOI using:
pip install thoi
-
Usage
After installation, you can start using THOI in your projects. Here is a simple example:
from thoi.measures.gaussian_copula import multi_order_measures, nplets_measures
from thoi.heuristics import simulated_annealing, greedy
import numpy as np
X = np.random.normal(0,1, (1000, 10))
# Computation of O information for the nplet that consider all the variables of X
measures = nplets_measures(X)
# Computation of O info for a single nplet (it must be a list of nplets even if it is a single nplet)
measures = nplets_measures(X, [[0,1,3]])
# Computation of O info for multiple nplets
measures = nplets_measures(X, [[0,1,3],[3,7,4],[2,6,3]])
# Extensive computation of O information measures over all combinations of features in X
measures = multi_order_measures(X)
# Compute the best 10 combinations of features (nplet) using greedy, starting by exaustive search in
# lower order and building from there. Result shows best O information for
# each built optimal orders
best_nplets, best_scores = greedy(X, 3, 5, repeat=10)
# Compute the best 10 combinations of features (nplet) using simulated annealing: There are two initialization options
# 1. Starting by a custom initial solution with shape (repeat, order) explicitely provided by the user.
# 2. Selecting random samples from the order.
# Result shows best O information for each built optimal orders
best_nplets, best_scores = simulated_annealing(X, 5, repeat=10)
For detailed usage and examples, please refer to the documentation.
Contributing
We welcome contributions from the community. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Citation
If you use the thoi
library in a scientific project, please cite it using one of the following formats:
BibTeX
@misc{thoi,
author = {Laouen Belloli and Rubén Herzog},
title = {THOI: An efficient library for higher order interactions analysis based on Gaussian copulas enhanced by batch-processing},
year = {2024},
url = {https://pypi.org/project/thoi/}
}
APA Belloli, L., & Herzog, R. (2023). THOI: An efficient library for higher order interactions analysis based on Gaussian copulas enhanced by batch-processing. Retrieved from https://pypi.org/project/thoi/
MLA Belloli, Laouen, and Rubén Herzog. THOI: An efficient library for higher order interactions analysis based on Gaussian copulas enhanced by batch-processing. 2023. Web. https://pypi.org/project/thoi/.
Authors
For more details, visit the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file thoi-0.2.0.tar.gz
.
File metadata
- Download URL: thoi-0.2.0.tar.gz
- Upload date:
- Size: 11.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648d3a089af740f84a1caa081a8738b011953c110083953731ebfe4fe8d6f1f1 |
|
MD5 | 42ba1cfa7cc05395178193fd9333c492 |
|
BLAKE2b-256 | cc8c0e1fa6eba9c62bef57c588e61d66ad7e63851e440bab296fc7cf8cdde46a |
File details
Details for the file thoi-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: thoi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf1e47f99e89279b59a74be446e366a595dbfdc1a7659d2249ea706f3cd1b6a9 |
|
MD5 | 4291f3fd4c6e898c7f4c3fac5ff527ef |
|
BLAKE2b-256 | a6f1881a58bfc5c1f701fbaaffac4adaafa65a325210549a8b3e6c674230e2a1 |