Forward Feature Selection Algorithm¶
- class feasel.f_FFSA.ForwardFeatureSel(dataset: ndarray, target: ndarray, selected: set[int] = None, n_features: int = 1, verbose: int = 0)¶
Bases:
FeaselBase- __init__(dataset: ndarray, target: ndarray, selected: set[int] = None, n_features: int = 1, verbose: int = 0)¶
Implements the Forward Feature Selection Algorithm found in “Mutual information-based feature selection for intrusion detection systems” by Amiri et al. https://doi.org/10.1016/j.jnca.2011.01.002
- Parameters:
dataset (np.ndarray) – Dataset of size (n_samples, n_features).
target (np.ndarray) – Target vector of size (n_samples,).
selected (set[int]) – Already selected feature index set of size (n_selected,). Default value is None.
n_features (int) – Number of features to select. Default value is 1.
verbose (int) – Verbosity. 0: no output; 1: prints execution time, selected feature and metric; 2: prints every step. Recommend turning off parallel execution when verbose is 2. Note that increased verbosity affects execution time. Default value is 0.
- Variables:
_flags – Dictionary of flags describing the capabilities of the algorithm.
_measures_used – Set of measure names used in the algorithm.
- Returns:
None
- Return type:
None
- transform() tuple[set[int], list[dict[int, float]], float]¶
Applies the algorithm.
- Returns:
Selected feature index or indices, measure values for all candidate features, execution time; tuple of size (3,).
- Return type:
tuple[set[int], list[dict[int, float]], float]