Core library for Neural Weight Fields (NWF) - charge, field, metrics, indices
Project description
nwf-core
Core library for Neural Weight Fields (NWF) - charge, field, metrics, indices, calibration.
Installation
pip install nwf-core
# With FAISS: pip install nwf-core[faiss]
# With VAE (torch): pip install nwf-core[torch]
# All: pip install nwf-core[all]
Quick start
import numpy as np
from nwf import Charge, Field, mahalanobis_symmetric
# Create charges
c1 = Charge(z=np.array([0.0, 0.0]), sigma=np.array([0.1, 0.1]))
c2 = Charge(z=np.array([1.0, 1.0]), sigma=np.array([0.1, 0.1]))
# Build field and search
field = Field()
field.add([c1, c2], labels=[0, 1])
distances, indices, labels = field.search(c1, k=2)
See documentation and nwf-vision for examples.
Components
- Charge:
(z, sigma)- center and diagonal covariance - Field: Container for charges with add/remove/search
- Metric: mahalanobis_symmetric, euclidean, cosine
- Index: BruteForceIndex, FAISSIndex (l2, cosine, ip; optional rerank with Mahalanobis)
- Calibration: AgreementRatio, PlattScaler
- Encoders: VAEEncoder (optional, requires torch)
Development
pip install -e ".[dev,docs]"
pre-commit install # optional: run checks before commit
make lint # black, isort, flake8
make format # auto-format
make html # build Sphinx docs -> docs/_build/html
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nwf_core-0.2.1.tar.gz
(13.7 kB
view details)
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
nwf_core-0.2.1-py3-none-any.whl
(13.4 kB
view details)
File details
Details for the file nwf_core-0.2.1.tar.gz.
File metadata
- Download URL: nwf_core-0.2.1.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c0465bbaf1e073f7268c662e5a866e2d96425166b6839a306597edede12d39
|
|
| MD5 |
d9dd439c664f3510f2bc67bc955fb980
|
|
| BLAKE2b-256 |
be425f557e5cb1fc694027faaab2193d21fb1ed8ad05aa2f078a80fc5ab8e34d
|
File details
Details for the file nwf_core-0.2.1-py3-none-any.whl.
File metadata
- Download URL: nwf_core-0.2.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
093f1450b72672696bce602237251b9cbd31e9ad31a244a13bcff7653aeb5a2f
|
|
| MD5 |
eb07bb7cc5da9722300f85bd4f812488
|
|
| BLAKE2b-256 |
d2ebb84b2cda2b2ede3f5d696c2fa7d0033ad64819098c417e6e1305c2cce4bb
|