Distance-based Feature Selection

class feasel.f_ORIG.DistanceFS(dataset: ndarray, target: ndarray, selected: set[int], n_features: int = 1, metric: str = 'weighted euclidean', verbose: int = 0)

Bases: FeaselBase

__init__(dataset: ndarray, target: ndarray, selected: set[int], n_features: int = 1, metric: str = 'weighted euclidean', verbose: int = 0)

Implements the Distance Based Feature Selection found in “Adaptive Hybrid Feature Selection (AHFS)” by Viharos et al. https://doi.org/10.1016/j.patcog.2021.107932

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 set of feature indices of size (n_selected,).

  • n_features (int) – Maximum number of features to select. Default value is 1.

  • metric (str) – The distance metric to use. Default value is “weighted euclidean”.

  • 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], float]

Applies the algorithm.

Returns:

Selected feature index or indices, execution time; tuple of size (2,).

Return type:

tuple[set[int], float]