Skip to content

v0.21.0

Choose a tag to compare

@EttoreRocchi EttoreRocchi released this 19 Oct 17:11
· 3 commits to main since this release

Added

  • Vectorized custom metrics: register_spectral_metric(..., pairwise=) accepts a whole-matrix implementation pairwise(X, Y), such as a scikit-learn distance function, which pairwise_distances uses instead of evaluating the metric pair by pair.

Changed

  • Faster built-in vector metrics: pairwise_distances computes cosine, pearson, and spectral_contrast_angle in a single vectorized step, for DataFrames and for lists of spectra on a common m/z grid. Spectra containing NaN or inf now raise ValueError for these metrics in common-grid lists, as they already did for DataFrames.

Fixed

  • Pearson distance on flat spectra: two flat spectra are at distance 0.0 and a flat spectrum is at 1.0 from any non-flat one, with no RuntimeWarning (previously this depended on floating-point rounding).