src.utils.ftransf.kbest_selector

Classes

KBestSelector(**kwargs)

class src.utils.ftransf.kbest_selector.KBestSelector(**kwargs)
Author:

Alberto M. Esmoris Pena

Class for transforming features by preserving only the top k features for a particular task.

Variables:
  • k (int) – The number of best features to select.

  • scoref (callable) – The score function f(F, y) to evaluate the features F to predict the values of y.

  • score_name (str) – The name of the score used for the evaluations.

  • kb – The internal KBest selection model.

static extract_ftransf_args(spec)

Extract the arguments to initialize/instantiate a KBestSelector.

Parameters:

spec – The key-word specification containing the arguments.

Returns:

The arguments to initialize/instantiate a KBestSelector.

static handle_score_from_type(spec, kwargs)

Handle the score from the specified type.

Parameters:
  • spec – The specification.

  • kwargs – The key-word arguments being built by kbest_selector.KBestSelector.extract_ftrasnf_args() to initialize a KBestSelector.

Returns:

True if a valid score was obtained from the given type, False otherwise.

__init__(**kwargs)

Initialize/instantiate a KBestSelector.

Parameters:

kwargs – The attributes for the KBestSelector.

transform(F, y=None, fnames=None, out_prefix=None)

The fundamental feature transform logic defining the k-best selector.

See FeatureTransformer and feature_transformer.FeatureTransformer.transform().