experiment_runner.encoders

Label-encoder lookup: the config string to a scikit-learn target encoder.

The table and the dotted-path escape hatch are described in experiment_runner.lookups, which this shares with the loss and optimizer families. The runner keeps the string as well as the object, because the split-cache directory name is built from it (get_split_cache_path()).

Attributes

logger

ENCODERS

Config name -> an sklearn-style target encoder class, constructed per dataset.

Functions

build_encoder(→ object)

Return a fresh encoder for the config value name.

Module Contents

experiment_runner.encoders.logger
experiment_runner.encoders.ENCODERS: dict[str, type]

Config name -> an sklearn-style target encoder class, constructed per dataset.

experiment_runner.encoders.build_encoder(name: str | None, params: dict | None = None) → object

Return a fresh encoder for the config value name.

Parameters:
  • name (str or None) – A key of ENCODERS, or a dotted import path to an encoder class (e.g. "sklearn.preprocessing.MultiLabelBinarizer"). None or an empty string gives the default LabelEncoder.

  • params (dict, optional) – Constructor arguments, e.g. {"classes": ["7Hz", "19Hz", "37Hz"]} for MultiHotLabelEncoder. Most encoders take none.

Returns:

An unfitted encoder, ready to hand to split().

Return type:

object

Raises:

ValueError – If name is not a string, is a retired name, or resolves to nothing; falling back to the default instead would train a different problem and report plausible numbers for it. Also if params were given without a name to apply them to.