ITMO_FS.filters.sparse.RFS

class ITMO_FS.filters.sparse.RFS(p, gamma=1, max_iterations=1000, epsilon=1e-05)

Performs the Robust Feature Selection via Joint L2,1-Norms Minimization algorithm.

Parameters:
  • p (int) – Number of features to select.
  • gamma (float, optional) – Regularization parameter.
  • max_iterations (int, optional) – Maximum amount of iterations to perform.
  • epsilon (positive float, optional) – Specifies the needed residual between the target functions from consecutive iterations. If the residual is smaller than epsilon, the algorithm is considered to have converged.

Notes

For more details see this paper.

Examples

>>> from ITMO_FS.filters.sparse import RFS
>>> from sklearn.datasets import make_classification
>>> import numpy as np
>>> dataset = make_classification(n_samples=100, n_features=20, n_informative=4, n_redundant=0, shuffle=False)
>>> data, target = np.array(dataset[0]), np.array(dataset[1])
>>> model = RFS(gamma=15, epsilon=1e-12)
>>> print(model.run(data, target))
__init__(p, gamma=1, max_iterations=1000, epsilon=1e-05)

Initialize self. See help(type(self)) for accurate signature.

feature_ranking(W)

Calculate the RFS score for a feature weight matrix.

Parameters:W (array-like, shape (n_features, c)) – Feature weight matrix.
Returns:indices – Indices of p selected features.
Return type:array-like, shape(p)
run(X, y)

Fits the algorithm.

Parameters:
  • X (array-like, shape (n_samples, n_features)) – The training input samples.
  • y (array-like, shape (n_samples) or (n_samples, n_classes)) – The target values or their one-hot encoding.
Returns:

W – Feature weight matrix.

Return type:

array-like, shape (n_features, n_classes)

Examples