ITMO_FS.filters.univariate.reliefF_measure

ITMO_FS.filters.univariate.reliefF_measure(X, y, k_neighbors=1)

Counts ReliefF measure for each feature

Note: Only for complete X Rather than repeating the algorithm m(TODO Ask Nikita about user defined) times, implement it exhaustively (i.e. n times, once for each instance) for relatively small n (up to one thousand).

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.
  • k_neighbors (int, optional = 1,) – The number of neighbors to consider when assigning feature importance scores. More neighbors results in more accurate scores, but takes longer. Selection of k hits and misses is the basic difference to Relief and ensures greater robustness of the algorithm concerning noise.
Returns:

Return type:

Score for each feature as a numpy array, shape (n_features, )

See also

R.J.(), Journal()

Examples

>>> import sklearn.datasets as datasets
>>> from ITMO_FS.filters.univariate import reliefF_measure
>>> X, y = datasets.make_classification(n_samples=200, n_features=7, shuffle=False)
>>> scores = reliefF_measure(X, y)
>>> print(scores)