algorithms/k-means/utilities.py
def euclidean(X, Y):
            """
            Returns the euclidean distance between X and Y. No sqrt applied.
            X and Y are tuples of the same dimension.
            """
            if len(X) != len(Y):
                raise Exception("Arguments do not have the same dimension")
            else:
                d = len(X)
                s = 0
                for i in range(d):
                    s += (X[i] - Y[i]) ** 2
                return sqrt(s)

            Returns the euclidean distance between X and Y. No sqrt applied.
            X and Y are tuples of the same dimension.
            
Returns the euclidean distance between X and Y. No sqrt applied.
X and Y are tuples of the same dimension.
Returns the euclidean distance between X and Y . No sqrt applied . X and Y are tuples of the same dimension .
def euclidean(X, Y):
            if len(X) != len(Y):
                raise Exception("Arguments do not have the same dimension")
            else:
                d = len(X)
                s = 0
                for i in range(d):
                    s += (X[i] - Y[i]) ** 2
                return sqrt(s)
def euclidean ( X , Y ) : if len ( X ) != len ( Y ) : raise Exception ( "Arguments do not have the same dimension" ) else : d = len ( X ) s = 0 for i in range ( d ) : s += ( X [ i ] - Y [ i ] ) ** 2 return sqrt ( s )
Returns the euclidean distance between X and Y.
Returns the euclidean distance between X and Y .
"""
            Returns the euclidean distance between X and Y. No sqrt applied.
            X and Y are tuples of the same dimension.
            """
X
Y