ITMO_FS.filters.univariate.f_ratio_measure

ITMO_FS.filters.univariate.f_ratio_measure(X, y)

Calculates Fisher score for features.

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()
//papers.nips.cc/paper/2909-laplacian-score-for-feature-selection.pdf

Examples

>>> import sklearn.datasets as datasets
>>> from ITMO_FS.filters.univariate import f_ratio_measure
>>> X = np.array([[3, 3, 3, 2, 2], [3, 3, 1, 2, 3], [1, 3, 5, 1, 1], [3, 1, 4, 3, 1], [3, 1, 2, 3, 1]])
>>> y = np.array([1, 3, 2, 1, 2])
>>> scores = f_ratio_measure(X, y)
>>> print(scores)