jpt.base.correlation.xi
Chatterjee’s xi correlation coefficient.
A rank-based measure of functional dependence introduced by Chatterjee (JASA, 2021). The coefficient equals 0 iff X and Y are independent and 1 iff Y is a measurable function of X.
Functions
|
Compute Chatterjee's xi correlation. |
|
Compute xi for all feature-target pairs. |
Module Contents
- jpt.base.correlation.xi.xi_correlation(x: numpy.ndarray, y: numpy.ndarray) float
Compute Chatterjee’s xi correlation.
Measures the degree to which
yis a measurable function ofx. Requires only two sorts and a linear pass, giving O(n log n) complexity.- Parameters:
x – feature values, shape (n,)
y – target values, shape (n,)
- Returns:
xi coefficient in [-0.5, 1]
- jpt.base.correlation.xi.xi_correlation_matrix(data: numpy.ndarray, feature_indices: numpy.ndarray, target_indices: numpy.ndarray, row_indices: numpy.ndarray | None = None) numpy.ndarray
Compute xi for all feature-target pairs.
Returns a matrix M where M[i, j] = xi(data[:, feature_indices[i]],
data[:, target_indices[j]]).
- Parameters:
data – array (n x d)
feature_indices – feature column indices
target_indices – target column indices
row_indices – optional row subset
- Returns:
xi matrix (nf x nt)