alibi_detect.saving.loading module

alibi_detect.saving.loading.load_detector(filepath, **kwargs)[source]

Load outlier, drift or adversarial detector.

Parameters:

filepath (Union[str, PathLike]) – Load directory.

Return type:

Union[Detector, ConfigurableDetector]

Returns:

Loaded outlier or adversarial detector object.

alibi_detect.saving.loading.read_config(filepath)[source]

This function reads a detector toml config file and returns a dict specifying the detector.

Parameters:

filepath (Union[PathLike, str]) – The filepath to the config.toml file.

Return type:

dict

Returns:

Parsed toml dictionary.

alibi_detect.saving.loading.resolve_config(cfg, config_dir)[source]

Resolves artefacts in a config dict. For example x_ref=’x_ref.npy’ is resolved by loading the np.ndarray from the .npy file. For a list of fields that are resolved, see https://docs.seldon.io/projects/alibi-detect/en/stable/overview/config_file.html.

Parameters:
  • cfg (dict) – The unresolved config dict.

  • config_dir (Optional[Path]) – Filepath to directory the config.toml is located in. Only required if different from the runtime directory, and artefacts are specified with filepaths relative to the config.toml file.

Return type:

dict

Returns:

The resolved config dict.