Tensor Network Kernel Machines (TNKM)
TNKM is a JAX-based library for machine learning with tensor-network parameterizations.
It combines kernel methods with low-rank tensor decompositions to build scalable models with explicit rank control.
TNKM is intended for research in machine learning, system identification, and time-series modeling.
Features
- CP and TT tensor-network kernel machines
- Polynomial, Fourier, B-spline and other feature maps
- Alternating Least Squares (ALS) and gradient-based optimization (Optax)
- Explicit rank control for balancing model complexity and expressiveness
- JAX-native implementation with JIT compilation and hardware acceleration
Installation
From PyPI
pip install tnkm
From source
git clone https://github.com/AlbMLpy/tnkm.git
cd tnkm
pip install .
Quick example
Fit a CP-based tensor-network kernel machine with polynomial features:
import jax.numpy as jnp
from tnkm.models import CPKM
from tnkm.optim import train_als
from tnkm.features import ProductFeatures, PolyFeature
d_dim = 2
x = jnp.ones((32, d_dim))
y = jnp.ones((32,))
features = ProductFeatures((PolyFeature(4, k_col=i) for i in range(d_dim)))
model = CPKM(features, rank=2, seed=0)
train_als(model, x, y, n_epoch=3, gamma_w=1e-3, beta_e=1.0)
y_pred = model.predict(x)
Documentation
Available at https://albmlpy.github.io/tnkm.
Contributing
Contributions to tnkm are welcome. If you would like to report issues,
suggest improvements, or contribute code, please see
CONTRIBUTING.md for development guidelines,
installation instructions, and information about the contribution workflow.
Citation
TNKM is an open-source research software project. If you use TNKM in academic work, please cite the specific software version used. Citation information will be updated when a DOI or publication becomes available.
(Also consider starring the project on GitHub)
License
MIT License
Release files for tnkm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tnkm-0.1.0.tar.gz | 29.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tnkm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.7 kB
Release files / tnkm-0.1.0.tar.gz
| Download URL | tnkm-0.1.0.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d01c94a860f20393ae86015e260b881f362c41e256d669737ce4a3c90f6e3732
|
|
BLAKE2b-256 checksum How to use checksums |
33fbd50159a5e2aab1417022edf69ecb022c91927926b92af5297b1cf3bb4f44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / tnkm-0.1.0-py3-none-any.whl
| Download URL | tnkm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 44.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7426cf863d0995c6eba39aabcedcac74118ee342dbc2589c05d0f3cc6f79a0cb
|
|
BLAKE2b-256 checksum How to use checksums |
5cb926369e8d6756440f21049fe46ff6fa8ae1314a7ed3fa1735e7ec7406cf33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency log