nispace.stats.coloc.mutualinfo
- nispace.stats.coloc.mutualinfo(x, y, n_neighbors=3, seed=None)[source]
Compute mutual information between x and y via sklearn’s k-NN estimator.
Thin wrapper around sklearn.feature_selection.mutual_info_regression (not numba-jitted).
- Parameters:
x (np.ndarray, shape (n_obs,) or (n_obs, 1)) – 1D input is reshaped to a column vector.
y (np.ndarray, shape (n_obs,)) –
n_neighbors (int, default 3) – Number of neighbors for the k-NN MI estimator.
seed (int, optional) – Passed as mutual_info_regression’s random_state. The estimator adds small random noise to break ties, so results are not reproducible across calls unless this is set.
- Returns:
mi
- Return type:
float
Notes
Not NaN-tolerant (sklearn errors on NaN) – called with pre-masked, NaN-free x[mask]/y[mask] in core/colocalize.py’s “mi” colocalization method.