Installation¶
Requirements¶
- Python 3.12 through 3.14
- NumPy 2.4+
For the differentiable PyTorch implementation, PyTorch 2.10+ is also required.
Install¶
With PyTorch support (for differentiable loss functions):
To install the latest development version directly from GitHub instead:
Import Name¶
The package is installed as fractional-information-gain but imported as fig:
The PyTorch module is not re-exported from the top-level package. Import it directly:
Development Setup¶
The project uses uv for dependency management:
git clone https://github.com/RenaissancePhilanthropy/fractional-information-gain.git
cd fractional-information-gain
uv sync --dev --extra torch
This installs all development dependencies (pytest, ruff, pre-commit) and the PyTorch extra.
To run the test suite:
R Package¶
The R implementation (figmetric) lives in the r/ subdirectory. See the
R Package page for installation instructions.