sklearn.feature_selection.r_regression¶
- 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.
- Parameters
- 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
Xand the target vectory. By default,Xandywill be centered.
- Returns
- correlation_coefficientndarray of shape (n_features,)
Pearson’s R correlation coefficients of features.
See also
f_regressionUnivariate linear regression tests returning f-statistic and p-values
mutual_info_regressionMutual information for a continuous target.
f_classifANOVA F-value between label/feature for classification tasks.
chi2Chi-squared stats of non-negative features for classification tasks.