experiment_runner.encoders ========================== .. py:module:: experiment_runner.encoders .. autoapi-nested-parse:: Label-encoder lookup: the config string to a scikit-learn target encoder. The table and the dotted-path escape hatch are described in :mod:`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 (:func:`~experiment_runner.cache.get_split_cache_path`). Attributes ---------- .. autoapisummary:: experiment_runner.encoders.logger experiment_runner.encoders.ENCODERS Functions --------- .. autoapisummary:: experiment_runner.encoders.build_encoder Module Contents --------------- .. py:data:: logger .. py:data:: ENCODERS :type: dict[str, type] Config name -> an sklearn-style target encoder class, constructed per dataset. .. py:function:: build_encoder(name: str | None, params: dict | None = None) -> object Return a fresh encoder for the config value *name*. :param name: A key of :data:`ENCODERS`, or a dotted import path to an encoder class (e.g. ``"sklearn.preprocessing.MultiLabelBinarizer"``). ``None`` or an empty string gives the default :class:`~sklearn.preprocessing.LabelEncoder`. :type name: str or None :param params: Constructor arguments, e.g. ``{"classes": ["7Hz", "19Hz", "37Hz"]}`` for :class:`~xai4tsc.data.MultiHotLabelEncoder`. Most encoders take none. :type params: dict, optional :returns: An unfitted encoder, ready to hand to :meth:`~xai4tsc.data.base.DatasetBase.split`. :rtype: 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.