(self, x1, x2=None)
return _interruptible_sqrt(distances, callback=callbacks.next())
The method
        - extracts normalized continuous attributes and then uses `row_norms`
          and `safe_sparse_do`t to compute the distance as x^2 - 2xy - y^2
          (the trick from sklearn);
        - calls a function in Cython that adds the contributions of discrete
          columns
The method
        - extracts normalized continuous attributes and then uses `row_norms`
          and `safe_sparse_do`t to compute the distance as x^2 - 2xy - y^2
          (the trick from sklearn);
        - calls a function in Cython that adds the contributions of discrete
          columns
The method - extracts normalized continuous attributes and then uses row_norms and safe_sparse_do t to compute the distance as x^2 - 2xy - y^2 ( the trick from sklearn ) ; - calls a function in Cython that adds the contributions of discrete columns
def compute_distances(self, x1, x2=None):
        """
        The method
        - extracts normalized continuous attributes and then uses `row_norms`
          and `safe_sparse_do`t to compute the distance as x^2 - 2xy - y^2
          (the trick from sklearn);
        - calls a function in Cython that adds the contributions of discrete
          columns
        """
        callbacks = StepwiseCallbacks(self.callback, [40, 30, 30])

        if self.normalize:
            x1 = x1 - self.means
            x1 /= np.sqrt(2 * self.vars)
        # adapted from sklearn.metric.euclidean_distances
        xx = row_norms(x1.T, squared=True)[:, np.newaxis]
        distances = _safe_sparse_dot(x1.T, x1, dense_output=True,
                                     callback=callbacks.next())
        distances *= -2
        distances += xx
        distances += xx.T
        with np.errstate(invalid="ignore"):  # Nans are fixed below
            np.maximum(distances, 0, out=distances)
        distances.flat[::distances.shape[0] + 1] = 0.0

        fixer = _distance.fix_euclidean_cols_normalized if self.normalize \
            else _distance.fix_euclidean_cols
        fixer(distances, x1, self.means, self.vars, callbacks.next())
        return _interruptible_sqrt(distances, callback=callbacks.next())
def compute_distances ( self , x1 , x2 = None ) : callbacks = StepwiseCallbacks ( self . callback , [ 40 , 30 , 30 ] ) if self . normalize : x1 = x1 - self . means x1 /= np . sqrt ( 2 * self . vars ) # adapted from sklearn.metric.euclidean_distances xx = row_norms ( x1 . T , squared = True ) [ : , np . newaxis ] distances = _safe_sparse_dot ( x1 . T , x1 , dense_output = True , callback = callbacks . next ( ) ) distances *= - 2 distances += xx distances += xx . T with np . errstate ( invalid = "ignore" ) : # Nans are fixed below np . maximum ( distances , 0 , out = distances ) distances . flat [ : : distances . shape [ 0 ] + 1 ] = 0.0 fixer = _distance . fix_euclidean_cols_normalized if self . normalize else _distance . fix_euclidean_cols fixer ( distances , x1 , self . means , self . vars , callbacks . next ( ) ) return _interruptible_sqrt ( distances , callback = callbacks . next ( ) )