ITMO_FS.filters.unsupervised
.TraceRatioLaplacian¶
-
class
ITMO_FS.filters.unsupervised.
TraceRatioLaplacian
(n_selected_features, k=5, t=1)¶ Creates TraceRatio(similarity based) feature selection filter performed in unsupervised way, i.e laplacian version
Parameters: - n_selected_features (int) – Amount of features to filter
- k (int) – number of neighbours to use for knn
- t (int) –
constant for kernel function calculation
- Note: in laplacian case only. In fisher it uses label similarity, i.e if both samples belong to same class
Notes
For more details see this paper.
Examples
>>> from ITMO_FS.filters.unsupervised.trace_ratio_laplacian import TraceRatioLaplacian >>> from sklearn.datasets import make_classification >>> x, y = make_classification(1000, 100, n_informative = 10, n_redundant = 30, n_repeated = 10, shuffle = False) >>> tracer = TraceRatioLaplacian(10) >>> print(tracer.run(x, y)[0])
-
__init__
(n_selected_features, k=5, t=1)¶ Initialize self. See help(type(self)) for accurate signature.
-
run
(X, y)¶ Fits filter
Parameters: - X (numpy array, shape (n_samples, n_features)) – The training input samples
- y (numpy array, shape (n_samples, )) – The target values
Returns: feature_indices – array of feature indices in X
Return type: numpy array
Examples