nispace.stats.coloc.elasticnet
- nispace.stats.coloc.elasticnet(x, y, cv=None, seed=None, **kwargs)[source]
Elastic-net regularized regression of x on y via sklearn.linear_model.ElasticNetCV.
- Parameters:
x (np.ndarray, shape (n_obs, n_predictors)) – Does not handle NaN – sklearn errors on NaN input; pre-mask.
y (np.ndarray, shape (n_obs,)) –
cv (int, cross-validation generator, or None) – Passed to ElasticNetCV for selecting alpha/l1_ratio.
seed (int, optional) – Passed as ElasticNetCV’s random_state.
**kwargs – Forwarded to ElasticNetCV.
- Returns:
out –
"alpha"/"l1ratio"(selected regularization strength/mix),"r2","beta"(shape(n_predictors,)).- Return type:
dict
Notes
Used by core/colocalize.py’s regularized-regression colocalization case. Unlike the other coloc.py methods (which exclude NaN case-wise, i.e. per predictor combination), the regularized methods (elasticnet/lasso/ridge) exclude NaN list-wise across all predictors at once before calling this function.