polymahalanobis
A polynomial Mahalanobis distance classifier for multivariate / multispectral data.
Given a set of reference samples, PolyMahalanobis builds a nested sequence of
polynomial-expanded subspaces (via SVD) and evaluates how far a new sample is
from that reference distribution — useful for anomaly detection, similarity
scoring, and multispectral classification (e.g. vegetation health from
satellite/drone imagery bands).
Only dependency: numpy.
Install
pip install polymahalanobis
Usage
import numpy as np
from polymahalanobis import PolyMahalanobis
# samples.txt: one reference sample per line, band values space-separated
model = PolyMahalanobis("samples.txt", num_levels=3)
model.makeSpace()
new_pixels = np.array([[120.0, 45.0, 200.0]], dtype=np.float32)
distances = model.evaluate(new_pixels) # shape (N, num_levels)
final_distance = distances[:, -1] # accumulated distance, last level
evaluate(spectral_values): batched evaluation,(N, n_bands) -> (N, num_levels).evaluate_single(spectral_value): convenience for a single(n_bands,)sample.evaluate_image(image_multispectral): convenience for a full(H, W, n_bands)array, with de-duplication of repeated pixel values.
Full project
This library is the core algorithm extracted from the PolynomialMahalanobis project, which also includes a parallelized command-line pipeline for classifying multispectral GeoTIFF orthophotos. That pipeline is not part of this PyPI package — see the repository for it.
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 polymahalanobis-0.1.0.tar.gz.
File metadata
- Download URL: polymahalanobis-0.1.0.tar.gz
- Upload date:
- Size: 7.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 |
c8c91bd9c661eddefcbe1516858e24dde8ef0ba87995281836ba0db5e1429164
|
|
| MD5 |
8d92376db6b5099a9e754f9936ba97e1
|
|
| BLAKE2b-256 |
5cfdba4afe6d4e40904724ae285d89a259b1e2c7fab4e3a4e6ac673272621000
|
Provenance
The following attestation bundles were made for polymahalanobis-0.1.0.tar.gz:
Publisher:
publish.yml on CodeWracker/PolynomialMahalanobis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymahalanobis-0.1.0.tar.gz -
Subject digest:
c8c91bd9c661eddefcbe1516858e24dde8ef0ba87995281836ba0db5e1429164 - Sigstore transparency entry: 2540244712
- Sigstore integration time:
-
Permalink:
CodeWracker/PolynomialMahalanobis@208cf1f4be4a56b6e0bb5ae4966e7df9849f9a34 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CodeWracker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@208cf1f4be4a56b6e0bb5ae4966e7df9849f9a34 -
Trigger Event:
release
-
Statement type:
File details
Details for the file polymahalanobis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polymahalanobis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 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 |
7e96af9da50f5f196f93b788bf14106e216a6615976d118605bbbfe17fbc905d
|
|
| MD5 |
300ed457711e837253b72af3ca147e61
|
|
| BLAKE2b-256 |
819663b4bec345772184da40a222b5c4f775e363ea84edeb8f9f43b460b1c711
|
Provenance
The following attestation bundles were made for polymahalanobis-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on CodeWracker/PolynomialMahalanobis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polymahalanobis-0.1.0-py3-none-any.whl -
Subject digest:
7e96af9da50f5f196f93b788bf14106e216a6615976d118605bbbfe17fbc905d - Sigstore transparency entry: 2540244795
- Sigstore integration time:
-
Permalink:
CodeWracker/PolynomialMahalanobis@208cf1f4be4a56b6e0bb5ae4966e7df9849f9a34 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CodeWracker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@208cf1f4be4a56b6e0bb5ae4966e7df9849f9a34 -
Trigger Event:
release
-
Statement type: