Installation

Prerequisites

  • Python 3.8 or higher


Install from PyPI

Install the base package with NumPy backend:

pip install hdmrlib

Optional Backends

HDMRLib supports multiple computational backends. You can install them via extras:

PyTorch backend

pip install hdmrlib[torch]

TensorFlow backend

pip install hdmrlib[tensorflow]

All backends

pip install hdmrlib[all]

Install from Source

Use this option if you want to work with the latest version of the codebase:

git clone https://github.com/hdmrlib/HDMRLib.git
cd HDMRLib
pip install -e .

Development Installation

For development and contributing:

pip install -e ".[dev]"

Verify Installation

You can verify the installation and backend setup:

from hdmrlib import EMPR

# Create sample data
import numpy as np
X = np.random.rand(10, 10)

# Run decomposition
empr = EMPR(X, order=2)
components = empr.components()

print(type(components))

Troubleshooting

Backend not found

Ensure the backend is installed:

pip install hdmrlib[torch]

or

pip install hdmrlib[tensorflow]

Import errors

Check installation:

pip show hdmrlib

If needed, reinstall:

pip install --upgrade --force-reinstall hdmrlib