sklearn.feature_selection.r_regression(X, y, *, center=True)[source]

Compute Pearson’s r for each features and the target.

Pearson’s r is also known as the Pearson correlation coefficient.

New in version 1.0.

Linear model for testing the individual effect of each of many regressors. This is a scoring function to be used in a feature selection procedure, not a free standing feature selection procedure.

The cross correlation between each regressor and the target is computed as ((X[:, i] - mean(X[:, i])) * (y - mean_y)) / (std(X[:, i]) * std(y)).

For more on usage see the User Guide.

X{array-like, sparse matrix} of shape (n_samples, n_features)

The data matrix.

yarray-like of shape (n_samples,)

The target vector.

centerbool, default=True

Whether or not to center the data matrix X and the target vector y. By default, X and y will be centered.

correlation_coefficientndarray of shape (n_features,)

Pearson’s R correlation coefficients of features.

See also


Univariate linear regression tests returning f-statistic and p-values


Mutual information for a continuous target.


ANOVA F-value between label/feature for classification tasks.


Chi-squared stats of non-negative features for classification tasks.