(self, X, Y=None)
return distance
Compute the VDM distance pairwise.

        Parameters
        ----------
        X : ndarray of shape (n_samples, n_features), dtype=np.int32
            The input data. The data are expected to be encoded with a
            :class:`~sklearn.preprocessing.OrdinalEncoder`.

        Y : ndarray of shape (n_samples, n_features), dtype=np.int32
            The input data. The data are expected to be encoded with a
            :class:`~sklearn.preprocessing.OrdinalEncoder`.

        Returns
        -------
        distance_matrix : ndarray of shape (n_samples, n_samples)
            The VDM pairwise distance.
Compute the VDM distance pairwise.
Compute the VDM distance pairwise .
def pairwise(self, X, Y=None):
        """Compute the VDM distance pairwise.

        Parameters
        ----------
        X : ndarray of shape (n_samples, n_features), dtype=np.int32
            The input data. The data are expected to be encoded with a
            :class:`~sklearn.preprocessing.OrdinalEncoder`.

        Y : ndarray of shape (n_samples, n_features), dtype=np.int32
            The input data. The data are expected to be encoded with a
            :class:`~sklearn.preprocessing.OrdinalEncoder`.

        Returns
        -------
        distance_matrix : ndarray of shape (n_samples, n_samples)
            The VDM pairwise distance.
        """
        check_is_fitted(self)
        X = self._validate_data(X, reset=False, dtype=np.int32)
        n_samples_X = X.shape[0]

        if Y is not None:
            Y = self._validate_data(Y, reset=False, dtype=np.int32)
            n_samples_Y = Y.shape[0]
        else:
            n_samples_Y = n_samples_X

        distance = np.zeros(shape=(n_samples_X, n_samples_Y), dtype=np.float64)
        for feature_idx in range(self.n_features_in_):
            proba_feature_X = self.proba_per_class_[feature_idx][X[:, feature_idx]]
            if Y is not None:
                proba_feature_Y = self.proba_per_class_[feature_idx][Y[:, feature_idx]]
            else:
                proba_feature_Y = proba_feature_X
            distance += (
                distance_matrix(proba_feature_X, proba_feature_Y, p=self.k) ** self.r
            )
        return distance
def pairwise ( self , X , Y = None ) : check_is_fitted ( self ) X = self . _validate_data ( X , reset = False , dtype = np . int32 ) n_samples_X = X . shape [ 0 ] if Y is not None : Y = self . _validate_data ( Y , reset = False , dtype = np . int32 ) n_samples_Y = Y . shape [ 0 ] else : n_samples_Y = n_samples_X distance = np . zeros ( shape = ( n_samples_X , n_samples_Y ) , dtype = np . float64 ) for feature_idx in range ( self . n_features_in_ ) : proba_feature_X = self . proba_per_class_ [ feature_idx ] [ X [ : , feature_idx ] ] if Y is not None : proba_feature_Y = self . proba_per_class_ [ feature_idx ] [ Y [ : , feature_idx ] ] else : proba_feature_Y = proba_feature_X distance += ( distance_matrix ( proba_feature_X , proba_feature_Y , p = self . k ) ** self . r ) return distance