@@ -515,7 +515,8 @@ def chi2_kernel(X, Y=None, gamma=1.):
515515
516516
517517# Helper functions - distance
518- pairwise_distance_functions = {
518+ #pairwise_distance_functions
519+ PAIRWISE_DISTANCE_FUNCTIONS = {
519520 # If updating this dictionary, update the doc in both distance_metrics()
520521 # and also in pairwise_distances()!
521522 'euclidean' : euclidean_distances ,
@@ -545,7 +546,7 @@ def distance_metrics():
545546 ============ ====================================
546547
547548 """
548- return pairwise_distance_functions
549+ return PAIRWISE_DISTANCE_FUNCTIONS
549550
550551
551552def _parallel_pairwise (X , Y , func , n_jobs , ** kwds ):
@@ -579,7 +580,7 @@ def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=1, **kwds):
579580 distance between the arrays from both X and Y.
580581
581582 Please note that support for sparse matrices is currently limited to those
582- metrics listed in pairwise.pairwise_distance_functions .
583+ metrics listed in pairwise.PAIRWISE_DISTANCE_FUNCTIONS .
583584
584585 Valid values for metric are:
585586
@@ -611,7 +612,7 @@ def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=1, **kwds):
611612 The metric to use when calculating distance between instances in a
612613 feature array. If metric is a string, it must be one of the options
613614 allowed by scipy.spatial.distance.pdist for its metric parameter, or
614- a metric listed in pairwise.pairwise_distance_functions .
615+ a metric listed in pairwise.PAIRWISE_DISTANCE_FUNCTIONS .
615616 If metric is "precomputed", X is assumed to be a distance matrix.
616617 Alternatively, if metric is a callable function, it is called on each
617618 pair of instances (rows) and the resulting value recorded. The callable
@@ -644,8 +645,8 @@ def pairwise_distances(X, Y=None, metric="euclidean", n_jobs=1, **kwds):
644645 """
645646 if metric == "precomputed" :
646647 return X
647- elif metric in pairwise_distance_functions :
648- func = pairwise_distance_functions [metric ]
648+ elif metric in PAIRWISE_DISTANCE_FUNCTIONS :
649+ func = PAIRWISE_DISTANCE_FUNCTIONS [metric ]
649650 if n_jobs == 1 :
650651 return func (X , Y , ** kwds )
651652 else :
0 commit comments