get_distance_callback

fast_plscan.get_distance_callback(metric, *, p=None, V=None, VI=None)

Returns a fast distance function callback for the specified metric. Potential keyword arguments are processed once here, and do not have to be repeated on the callback.

Parameters:
  • metric (str) – The distance metric to use. See VALID_BALLTREE_METRICS for a list of valid metrics. See sklearn documentation for metric definitions.

  • p (float | None, default: None) – The order of the Minkowski distance. Required if metric is “minkowski”.

  • V (ndarray[tuple[int], dtype[single]] | None, default: None) – The variance vector for the standardized Euclidean distance. Required if metric is “seuclidean”.

  • VI (ndarray[tuple[int, int], dtype[single]] | None, default: None) – The inverse covariance matrix for the Mahalanobis distance. Required if metric is “mahalanobis”.

Return type:

Callable[[ndarray[tuple[int], dtype[single]], ndarray[tuple[int], dtype[single]]], float]

Returns:

dist – The distance function callback. Inputs must be 1D c-contiguous numpy arrays of float32.