Categorical nominal#

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

Compute the nominal categorical component of Gower metric between rows of X and Y.

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

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

  • categorical_indices (list[int]) – Indices of nominal categorical features.

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

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

Returns:

  • sum_diff: matrix (n_x, n_y) of weighted counts of differing features

  • count_present: matrix (n_x, n_y) of counts of present (non-missing) features

Return type:

tuple[np.ndarray, np.ndarray]