Binary asymmetric#

binary_asymmetric_component(X: ndarray, Y: ndarray, binary_indices: list[int], missing_strategy: str = 'ignore', weights: ndarray | None = None) tuple[ndarray, ndarray][source]#

Compute the asymmetric binary component of Gower metric between rows of X and Y.

Description:
  • Similarity s_ijt = 1 if x_it = x_jt = 1, else 0.

  • δ_ijt (present) = 1 if both non-missing and at least one equals 1, else 0.

  • Distance d_ijt = 1 - s_ijt for δ_ijt = 1, ignored otherwise.

Parameters:
  • X (np.ndarray) – shape (n_x, n_features).

  • Y (np.ndarray) – shape (n_y, n_features).

  • binary_indices (list[int]) – indices of asymmetric binary features.

  • missing_strategy (str) – strategy for handling missing values, default is ‘ignore’.

  • weights (Optional[np.ndarray]) – optional per-feature weights.

Returns:

  • sum_diff: matrix (n_x, n_y); weighted sum of d_ijt

  • count_present: matrix (n_x, n_y); δ_ijt counts

Return type:

tuple[np.ndarray, np.ndarray]