ITMO_FS.filters.univariate
.spearman_corr¶
-
ITMO_FS.filters.univariate.
spearman_corr
(X, y)¶ Calculates spearman correlation for each feature. Spearman’s correlation assesses monotonic relationships (whether linear or not). If there are no repeated data values, a perfect Spearman correlation of +1 or −1 occurs when each of the variables is a perfect monotone function of the other.
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/Spearman%27s_rank_correlation_coefficient
Examples
>>> import sklearn.datasets as datasets >>> from ITMO_FS.filters.univariate import spearman_corr >>> X, y = datasets.make_classification(n_samples=200, n_features=7, shuffle=False) >>> scores = spearman_corr(X, y) >>> print(scores)