Binary symmetric#

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

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

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

  • δ_ijt (present) = 1 if both values are non-missing, 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 binary symmetric features.

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

  • weights (Optional[np.ndarray]) – Optional weight per binary feature.

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]