(self, x1, x2)
return distances
The method
        - extracts normalized continuous attributes and computes distances
          ignoring the possibility of nans
        - recomputes the distances between pairs of rows that yielded nans
        - adds the contributions of discrete columns using the same function as
          the Euclidean distance
The method
        - extracts normalized continuous attributes and computes distances
          ignoring the possibility of nans
        - recomputes the distances between pairs of rows that yielded nans
        - adds the contributions of discrete columns using the same function as
          the Euclidean distance
The method - extracts normalized continuous attributes and computes distances ignoring the possibility of nans - recomputes the distances between pairs of rows that yielded nans - adds the contributions of discrete columns using the same function as the Euclidean distance
def compute_distances(self, x1, x2):
        """
        The method
        - extracts normalized continuous attributes and computes distances
          ignoring the possibility of nans
        - recomputes the distances between pairs of rows that yielded nans
        - adds the contributions of discrete columns using the same function as
          the Euclidean distance
        """
        callbacks = StepwiseCallbacks(self.callback, [5, 5, 60, 30])

        if self.continuous.any():
            data1, data2 = self.continuous_columns(
                x1, x2, self.medians, 2 * self.mads)
            distances = _distance.manhattan_rows_cont(
                data1, data2, x2 is not None, callbacks.next())
            if self.normalize:
                _distance.fix_manhattan_rows_normalized(
                    distances, data1, data2, x2 is not None, callbacks.next())
            else:
                _distance.fix_manhattan_rows(
                    distances, data1, data2,
                    self.medians, self.mads, self.dist_missing2_cont,
                    x2 is not None, callbacks.next())
        else:
            distances = np.zeros((x1.shape[0],
                                  (x2 if x2 is not None else x1).shape[0]))

        if np.any(self.discrete):
            data1, data2 = self.discrete_columns(x1, x2)
            # For discrete attributes, Euclidean is same as Manhattan
            _distance.euclidean_rows_discrete(
                distances, data1, data2, self.dist_missing_disc,
                self.dist_missing2_disc, x2 is not None, callbacks.next())

        if x2 is None:
            _distance.lower_to_symmetric(distances, callbacks.next())
        return distances
def compute_distances ( self , x1 , x2 ) : callbacks = StepwiseCallbacks ( self . callback , [ 5 , 5 , 60 , 30 ] ) if self . continuous . any ( ) : data1 , data2 = self . continuous_columns ( x1 , x2 , self . medians , 2 * self . mads ) distances = _distance . manhattan_rows_cont ( data1 , data2 , x2 is not None , callbacks . next ( ) ) if self . normalize : _distance . fix_manhattan_rows_normalized ( distances , data1 , data2 , x2 is not None , callbacks . next ( ) ) else : _distance . fix_manhattan_rows ( distances , data1 , data2 , self . medians , self . mads , self . dist_missing2_cont , x2 is not None , callbacks . next ( ) ) else : distances = np . zeros ( ( x1 . shape [ 0 ] , ( x2 if x2 is not None else x1 ) . shape [ 0 ] ) ) if np . any ( self . discrete ) : data1 , data2 = self . discrete_columns ( x1 , x2 ) # For discrete attributes, Euclidean is same as Manhattan _distance . euclidean_rows_discrete ( distances , data1 , data2 , self . dist_missing_disc , self . dist_missing2_disc , x2 is not None , callbacks . next ( ) ) if x2 is None : _distance . lower_to_symmetric ( distances , callbacks . next ( ) ) return distances