Base Classes and Mixins¶
FSFC uses some base classes and mixins, based on sklearn estimators and classifiers. It makes the library
fully compatible with sklearn, so feature selectors can be used in pipelines
Mixins¶
Some default mixins which extend ones defined in sklearn
-
class
fsfc.mixins.KBestSelectorMixin[source]¶ Bases:
fsfc.mixins.ScoreSelectorMixinMixin that selects K best features according to their scores
-
class
fsfc.mixins.ScoreSelectorMixin[source]¶ Bases:
objectMixin that adds getter for calculation of scores of features and checks that scores are calculated
-
class
fsfc.mixins.ThresholdSelectorMixin[source]¶ Bases:
fsfc.mixins.ScoreSelectorMixinMixin that selects features according to some threshold. That means that all features whose score is higher than threshold are selected
Classes¶
Base classes of all feature selecting / clustering algorithms of FSFC
-
class
fsfc.base.BaseFeatureSelector[source]¶ Bases:
sklearn.base.BaseEstimator,sklearn.feature_selection.base.SelectorMixinBase class for all feature selection algorithms. It’s SKLearn-compliant, so it can be used in pipelines.
Successors should override methods
fit()and_get_support_mask().Methods
fit(x, *rest)Fit selector to a dataset. fit_transform(X[, y])Fit to data, then transform it. get_params([deep])Get parameters for this estimator. get_support([indices])Get a mask, or integer index, of the features selected inverse_transform(X)Reverse the transformation operation set_params(**params)Set the parameters of this estimator. transform(X)Reduce X to the selected features.
-
class
fsfc.base.ClusteringFeatureSelector(k)[source]¶ Bases:
fsfc.mixins.KBestSelectorMixin,fsfc.base.BaseFeatureSelector,sklearn.base.ClusterMixinClusters samples and simultaneously finds relevant features. Allows to transform dataset and select K best features according to features scores.
Parameters: - k: int
Number of features to select
Methods
fit(x, *rest)fit_predict(X[, y])Performs clustering on X and returns cluster labels. fit_transform(X[, y])Fit to data, then transform it. get_params([deep])Get parameters for this estimator. get_support([indices])Get a mask, or integer index, of the features selected inverse_transform(X)Reverse the transformation operation set_params(**params)Set the parameters of this estimator. transform(X)Reduce X to the selected features.
-
class
fsfc.base.KBestFeatureSelector(k)[source]¶ Bases:
fsfc.mixins.KBestSelectorMixin,fsfc.base.BaseFeatureSelectorBase class for algorithms that selects K best features according to features scores.
Successors should override method
_calc_scores()for computation of the score.Parameters: - k: int
Number of features to select
Methods
fit(x, *rest)fit_transform(X[, y])Fit to data, then transform it. get_params([deep])Get parameters for this estimator. get_support([indices])Get a mask, or integer index, of the features selected inverse_transform(X)Reverse the transformation operation set_params(**params)Set the parameters of this estimator. transform(X)Reduce X to the selected features.