distance_metrics#

sklearn.metrics.pairwise.distance_metrics()[source]#

Valid metrics for pairwise_distances.

This function simply returns the valid pairwise distance metrics. It exists to allow for a description of the mapping for each of the valid strings.

The valid distance metrics, and the function they map to, are:

metric

Function

‘cityblock’

metrics.pairwise.manhattan_distances

‘cosine’

metrics.pairwise.cosine_distances

‘euclidean’

metrics.pairwise.euclidean_distances

‘haversine’

metrics.pairwise.haversine_distances

‘l1’

metrics.pairwise.manhattan_distances

‘l2’

metrics.pairwise.euclidean_distances

‘manhattan’

metrics.pairwise.manhattan_distances

‘nan_euclidean’

metrics.pairwise.nan_euclidean_distances

Read more in the User Guide.

Returns:
distance_metricsdict

Returns valid metrics for pairwise_distances.