ITMO_FS.filters.univariate
.pearson_corr¶
-
ITMO_FS.filters.univariate.
pearson_corr
(X, y)¶ Calculates pearson correlation for each feature. Pearson correleation coeficient is a statistic that measures linear correlation between two variables X and Y. It has a value in interval [-1, +1], where 1 is total positive linear correlation, 0 is no linear correlation, and −1 is total negative linear correlation
Parameters: - X (numpy array, shape (n_samples, n_features)) – The input samples.
- y (numpy array, shape (n_samples, )) – The classes for the samples.
Returns: Return type: Score for each feature as a numpy array, shape (n_features, )
See also
https()
- //en.wikipedia.org/wiki/Pearson_correlation_coefficient
Examples
>>> import sklearn.datasets as datasets >>> from ITMO_FS.filters.univariate import pearson_corr >>> X, y = datasets.make_classification(n_samples=200, n_features=7, shuffle=False) >>> scores = pearson_corr(X, y) >>> print(scores)