Skip to main content

Wasserstein metric plugin for Swarmauri vector comparisons.

Project description

Swarmauri Logo

This package is deprecated and will be removed from the active Swarmauri workspace by 0.12.0. Use it only as a compatibility shim while migrating away from the deprecated Distance contract.

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swamauri_metric_wasserstein Discord

Swamauri Metric Wasserstein

swamauri_metric_wasserstein provides a Swarmauri-compatible metric class for computing the first Wasserstein distance (Earth Mover's Distance) between numeric vectors.

Preferred Replacement

  • Preferred package: swarmauri_standard
  • Current state: no active standalone Wasserstein replacement package exists in the workspace.
  • Migration path: keep this deprecated package only for compatibility, or vendor a project-specific metric until a correctly named active package is published.

Features

  • Implements WassersteinMetric as a MetricBase plugin.
  • Computes distance using a built-in pure-Python 1D Wasserstein implementation.
  • Includes helper methods for batched distances and similarities.
  • Supports Python 3.10, 3.11, and 3.12.

Installation

uv pip install swamauri_metric_wasserstein
pip install swamauri_metric_wasserstein

Usage

from swamauri_metric_wasserstein import WassersteinMetric
from swarmauri_standard.vectors.Vector import Vector

vector_a = Vector(value=[0.0, 1.0, 2.0])
vector_b = Vector(value=[0.0, 1.0, 2.0])

distance_calculator = WassersteinMetric()

distance = distance_calculator.distance(vector_a, vector_b)
similarity = distance_calculator.similarity(vector_a, vector_b)

print(f"Distance: {distance}")
print(f"Similarity: {similarity}")

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swamauri_metric_wasserstein-0.11.0.dev1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swamauri_metric_wasserstein-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swamauri_metric_wasserstein-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swamauri_metric_wasserstein-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 61aef5a1a2c128d4d7fc0fad2795a496838b60220800b104981eee233cfd9aa5
MD5 11a42d073db9bd9a08ddce7c060281fe
BLAKE2b-256 bdf2e928153eaf17fbcb7fd73912b80804dad246919b1f4c7c063d6d451e65aa

See more details on using hashes here.

File details

Details for the file swamauri_metric_wasserstein-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swamauri_metric_wasserstein-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swamauri_metric_wasserstein-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b1a1e86c7ff1e1fde7f2fbd4a54e53746e7f65399a22bffce67b3148efec719
MD5 e317b2d92891ed724809c4f904e585bc
BLAKE2b-256 ba3d652d00c1f68c67bdcdddfa74c7a994f8e5bf296c6db2ce12923732bf330a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page