JAX-accelerated Adaptive Mixture Independent Component Analysis for Python.
jamica is a JAX implementation of AMICA (Adaptive Mixture Independent Component Analysis), an algorithm for blind source separation. It is aimed mainly at EEG.
AMICA is one of the strongest methods in the ICA family for EEG decomposition. The original implementation is a Fortran program from UCSD, usually run through MATLAB or EEGLAB. jamica rewrites it in Python on top of JAX, so the same code JIT-compiles and runs on either CPU or GPU, and it works directly with MNE-Python.
Why jamica?
JAX + AMICA = jamica. The name also describes the problem AMICA solves.
Record a jam session with a few microphones. Each one picks up a different blend of the same players. Getting the individual instruments back out of those recordings is blind source separation, which is what ICA does for EEG: electrodes pick up mixtures of cortical, muscular and ocular activity, and the job is to pull them apart again.
A jam is rarely one fixed mixture, though. Players drop in and out. Someone takes a solo. The statistics of what the microphones hear keep shifting. AMICA handles this by fitting several mixture models instead of one, and by learning the shape of each source distribution rather than assuming it. That makes it a good match for data a single stationary ICA model does not describe well.
jamica runs that algorithm on JAX, on CPU or GPU, inside the usual Python scientific stack.
Status: jamica reproduces the Fortran AMICA 1.7 reference on the tested single-model configurations. See Validation.
Highlights
- The AMICA algorithm in Python, JIT-compiled through JAX
- Runs on CPU or GPU without changing your code
- Numerical agreement with the Fortran AMICA 1.7 reference on the tested configurations
- Native integration with MNE-Python
- Support for multi-model AMICA
- Modern scientific Python API
- Extensive testing and continuous integration
- Fully open source (BSD-3-Clause)
Installation
pip install "jamica[jax]"
or, from conda-forge:
conda install -c conda-forge jamica jax
Renamed from
amica. Releases up to 0.1.0 were published asamica. That name installed a top-levelamicamodule, which collided withamica-python— an independent implementation of the same algorithm by another author — so the two could not coexist in one environment. Since 0.2.0 this project installs asjamica, and the two can be installed side by side.
For NVIDIA GPUs, take the CUDA build of JAX instead:
pip install "jamica[gpu]" # JAX with CUDA 12 (Linux only)
The other extras are separate, so you only install what you need:
pip install "jamica[mne]" # MNE-Python integration, fit_ica()
pip install "jamica[icalabel]" # ICLabel component classification
pip install "jamica[viz]" # plotting and density diagnostics
pip install "jamica[all]" # everything above
From source
For development, or to run the test suite:
git clone https://github.com/snesmaeili/jamica.git
cd jamica
pip install -e ".[dev]"
With uv:
git clone https://github.com/snesmaeili/jamica.git
cd jamica
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
Quick Start
from jamica import Amica, AmicaConfig
config = AmicaConfig(
max_iter=2000,
num_mix_comps=3,
)
model = Amica(config, random_state=42)
result = model.fit(data)
sources = model.transform(data)
For MNE-Python:
from jamica import fit_ica
ica = fit_ica(raw)
ica.plot_components()
ica.apply(raw)
For integrations that already whiten and PCA-reduce their data, jamica.amica
is the stable single-model solver boundary:
from jamica import amica
_, W, sources, n_iter = amica(
X_ica,
whiten=False,
return_n_iter=True,
random_state=42,
)
Here X_ica is shaped (n_components, n_samples), sources == W @ X_ica,
and JAMICA performs no additional centering, whitening, or PCA. Multi-model
adaptive ICA and its model probabilities remain available through the native
JAMICA API rather than this conventional-ICA boundary.
See the MNE single-model solver contract for the exact matrix, preprocessing, random-state, and error guarantees.
Examples
Example scripts are available in the examples/ directory, including:
- MNE-Python integration
- Native AMICA API
- JAX acceleration
- Multi-model AMICA
- HPC / SLURM execution
Documentation
Full documentation, API reference, validation experiments, and tutorials are available at
https://snesmaeili.github.io/jamica/
Validation
jamica reproduces the Fortran AMICA 1.7 reference on single-model fits: final log-likelihoods,
unmixing matrices and adaptive-density parameters agree closely across K=1 and K=3 density terms,
under both Newton and natural-gradient updates, and on a 100-iteration audit on real EEG.
Protocols, the patched reference build, comparisons against other AMICA implementations and against Picard, extended Infomax and FastICA, and every figure and table in the manuscript are in jamica-benchmark. Exact scope is in the documentation.
Contributing
Contributions are welcome!
Please read CONTRIBUTING.md before opening a pull request.
Parts of jamica were written with AI assistance; AI_USAGE.md says where, and what it does not change about how the package is verified.
Citation
If jamica contributes to your research, please cite the original AMICA publications.
Citation metadata is available in CITATION.cff.
License
jamica is distributed under the terms of the BSD 3-Clause License.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jamica-0.3.0.tar.gz.
File metadata
- Download URL: jamica-0.3.0.tar.gz
- Upload date:
- Size: 139.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06ee3a5b8aee630bddd2edb2d59412c309b0a37882ec5ee2cc8d1bf7d6aa8094
|
|
| MD5 |
985952615dcf65f5af9fb11fa525b246
|
|
| BLAKE2b-256 |
0c4f46f4e38f0904fa794541fdc5225d78c9f2d8947296eb98452eba83da19ee
|
Provenance
The following attestation bundles were made for jamica-0.3.0.tar.gz:
Publisher:
release.yml on snesmaeili/jamica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jamica-0.3.0.tar.gz -
Subject digest:
06ee3a5b8aee630bddd2edb2d59412c309b0a37882ec5ee2cc8d1bf7d6aa8094 - Sigstore transparency entry: 2628758010
- Sigstore integration time:
-
Permalink:
snesmaeili/jamica@1d1b227a41eb536ca0fed126f44d903b43d1c83c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/snesmaeili
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d1b227a41eb536ca0fed126f44d903b43d1c83c -
Trigger Event:
release
-
Statement type:
File details
Details for the file jamica-0.3.0-py3-none-any.whl.
File metadata
- Download URL: jamica-0.3.0-py3-none-any.whl
- Upload date:
- Size: 101.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a185ed9a847512bcf2250e47b2b154f471ad8b9f93373eea08bff2eb4c5a8f1d
|
|
| MD5 |
1d0a78c169a7565a1f4d170e65135837
|
|
| BLAKE2b-256 |
46f357e3401b6041d91af95346883513802ef62843ffee206e368d5cc89eadf2
|
Provenance
The following attestation bundles were made for jamica-0.3.0-py3-none-any.whl:
Publisher:
release.yml on snesmaeili/jamica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jamica-0.3.0-py3-none-any.whl -
Subject digest:
a185ed9a847512bcf2250e47b2b154f471ad8b9f93373eea08bff2eb4c5a8f1d - Sigstore transparency entry: 2628758022
- Sigstore integration time:
-
Permalink:
snesmaeili/jamica@1d1b227a41eb536ca0fed126f44d903b43d1c83c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/snesmaeili
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d1b227a41eb536ca0fed126f44d903b43d1c83c -
Trigger Event:
release
-
Statement type: