PyLDL icon indicating copy to clipboard operation
PyLDL copied to clipboard

[Feature Proposal] Add Wasserstein Distance metric to pyldl/metrics.py

Open KostasOikonomou opened this issue 2 weeks ago • 1 comments

Hi! I am a computer science student working on an academic open-source contribution project, and I would love to contribute to PyLDL.

After reviewing the codebase—specifically pyldl/metrics.py—I noticed that while several divergence and distance metrics are available (such as KL divergence, Jensen-Shannon, and Canberra), the Wasserstein Distance (Earth Mover's Distance) is not currently included.

Proposed Scope of Contribution

  1. Implementation & Documentation: Implement the wasserstein(D, D_pred) metric in pyldl/metrics.py using NumPy/SciPy, complete with a formal LaTeX mathematical docstring and registration via the existing @_register("D") decorator.
  2. Unit Testing: Add robust unit tests in the tests/ directory to ensure correctness and stability across edge cases.
  3. Benchmarking & Comparison: Provide a benchmarking script comparing Wasserstein Distance against KL-Divergence under distribution shift scenarios, visualized via matplotlib.

Please let me know if you are open to this contribution or if you have any specific preferences regarding the implementation! Thank you for your time and for maintaining this wonderful toolkit.

KostasOikonomou avatar Nov 16 '26 12:11 KostasOikonomou

Thank you for your interest in PyLDL! Contributions are welcome.

SpriteMisaka avatar Nov 17 '26 02:11 SpriteMisaka