8000 MAINT Remove commented dissimilarities (#23457) · scikit-learn/scikit-learn@bb6a0ef · GitHub
[go: up one dir, main page]

Skip to content

Commit bb6a0ef

Browse files
committed
MAINT Remove commented dissimilarities (#23457)
1 parent de24089 commit bb6a0ef

File tree

1 file changed

+0
-66
lines changed

1 file changed

+0
-66
lines changed

sklearn/metrics/_dist_metrics.pyx

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,72 +1097,6 @@ cdef class HaversineDistance(DistanceMetric):
10971097
tmp = np.sin(0.5 * dist)
10981098
return tmp * tmp
10991099

1100-
1101-
#------------------------------------------------------------
1102-
# Yule Distance (boolean)
1103-
# D(x, y) = 2 * ntf * nft / (ntt * nff + ntf * nft)
1104-
# [This is not a true metric, so we will leave it out.]
1105-
#
1106-
#cdef class YuleDistance(DistanceMetric):
1107-
# cdef inline DTYPE_t dist(self, const DTYPE_t* x1, const DTYPE_t* x2,
1108-
# ITYPE_t size):
1109-
# cdef int tf1, tf2, ntf = 0, nft = 0, ntt = 0, nff = 0
1110-
# cdef np.intp_t j
1111-
# for j in range(size):
1112-
# tf1 = x1[j] != 0
1113-
# tf2 = x2[j] != 0
1114-
# ntt += tf1 and tf2
1115-
# ntf += tf1 and (tf2 == 0)
1116-
# nft += (tf1 == 0) and tf2
1117-
# nff = size - ntt - ntf - nft
1118-
# return (2.0 * ntf * nft) / (ntt * nff + ntf * nft)
1119-
1120-
1121-
#------------------------------------------------------------
1122-
# Cosine Distance
1123-
# D(x, y) = dot(x, y) / (|x| * |y|)
1124-
# [This is not a true metric, so we will leave it out.]
1125-
#
1126-
#cdef class CosineDistance(DistanceMetric):
1127-
# cdef inline DTYPE_t dist(self, const DTYPE_t* x1, const DTYPE_t* x2,
1128-
# ITYPE_t size):
1129-
# cdef DTYPE_t d = 0, norm1 = 0, norm2 = 0
1130-
# cdef np.intp_t j
1131-
# for j in range(size):
1132-
# d += x1[j] * x2[j]
1133-
# norm1 += x1[j] * x1[j]
1134-
# norm2 += x2[j] * x2[j]
1135-
# return 1.0 - d / sqrt(norm1 * norm2)
1136-
1137-
1138-
#------------------------------------------------------------
1139-
# Correlation Distance
1140-
# D(x, y) = dot((x - mx), (y - my)) / (|x - mx| * |y - my|)
1141-
# [This is not a true metric, so we will leave it out.]
1142-
#
1143-
#cdef class CorrelationDistance(DistanceMetric):
1144-
# cdef inline DTYPE_t dist(self, const DTYPE_t* x1, const DTYPE_t* x2,
1145-
# ITYPE_t size):
1146-
# cdef DTYPE_t mu1 = 0, mu2 = 0, x1nrm = 0, x2nrm = 0, x1Tx2 = 0
1147-
# cdef DTYPE_t tmp1, tmp2
1148-
#
1149-
# cdef np.intp_t i
1150-
# for i in range(size):
1151-
# mu1 += x1[i]
1152-
# mu2 += x2[i]
1153-
# mu1 /= size
1154-
# mu2 /= size
1155-
#
1156-
# for i in range(size):
1157-
# tmp1 = x1[i] - mu1
1158-
# tmp2 = x2[i] - mu2
1159-
# x1nrm += tmp1 * tmp1
1160-
# x2nrm += tmp2 * tmp2
1161-
# x1Tx2 += tmp1 * tmp2
1162-
#
1163-
# return (1. - x1Tx2) / sqrt(x1nrm * x2nrm)
1164-
1165-
11661100
#------------------------------------------------------------
11671101
# User-defined distance
11681102
#

0 commit comments

Comments
 (0)
0