This is the official implementation of the Neural Clustering Additive Model (NeurCAM): https://arxiv.org/abs/2408.13361
First, install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | shThen, install NeurCAM:
# Clone the repository
git clone https://github.com/alexwolson/NeurCAM.git
cd NeurCAM
# Install the package with uv
uv pip install -e .
# For development with optional dependencies
uv pip install -e ".[dev]"pip install -e .If you need CUDA support for GPU acceleration, install PyTorch with CUDA separately:
# For CUDA 11.8
uv pip install torch --index-url https://download.pytorch.org/whl/cu118
# For CUDA 12.1
uv pip install torch --index-url https://download.pytorch.org/whl/cu121from sklearn.datasets import load_iris
from neurcam import NeurCAM
# Load data
iris = load_iris()
X = iris.data
# Create and fit model
nc = NeurCAM(k=3, epochs=5000)
nc = nc.fit(X)
# Make predictions
neurcam_pred = nc.predict(X)To set up the development environment:
# Install with development dependencies
uv pip install -e ".[dev]"
# Format code with black
black neurcam/