alibi_detect.utils.fetching module

alibi_detect.utils.fetching.fetch_ad_ae(url, filepath, state_dict)[source]

Download AE adversarial detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

  • state_dict (dict) – Dictionary containing the detector’s parameters.

Return type

None

alibi_detect.utils.fetching.fetch_ad_md(url, filepath)[source]

Download model and distilled model.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.fetch_ae(url, filepath)[source]

Download AE outlier detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.fetch_aegmm(url, filepath)[source]

Download AEGMM outlier detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.fetch_detector(filepath, detector_type, dataset, detector_name, model=None)[source]

Fetch an outlier or adversarial detector from a google bucket, save it locally and return the initialised detector.

Parameters
  • filepath (Union[str, PathLike]) – Local directory to save detector to.

  • detector_type (str) – outlier or adversarial.

  • dataset (str) – Dataset of pre-trained detector. E.g. kddcup, cifar10 or ecg.

  • detector_name (str) – Name of the detector in the bucket.

  • model (Optional[str]) – Classification model used for adversarial detection.

Return type

Union[BaseDetector, AdversarialAE, ModelDistillation, IForest, LLR, Mahalanobis, OutlierAEGMM, OutlierAE, OutlierProphet, OutlierSeq2Seq, OutlierVAE, OutlierVAEGMM, SpectralResidual]

Returns

Initialised pre-trained detector.

alibi_detect.utils.fetching.fetch_enc_dec(url, filepath)[source]

Download encoder and decoder networks.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.fetch_llr(url, filepath)[source]

Download Likelihood Ratio outlier detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

str

alibi_detect.utils.fetching.fetch_seq2seq(url, filepath)[source]

Download sequence-to-sequence outlier detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.fetch_state_dict(url, filepath, save_state_dict=True)[source]

Fetch the metadata and state/hyperparameter values of pre-trained detectors.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

  • save_state_dict (bool) – Whether to save the state dict locally.

Return type

Tuple[dict, dict]

Returns

Detector metadata and state.

alibi_detect.utils.fetching.fetch_tf_model(dataset, model)[source]

Fetch pretrained tensorflow models from the google cloud bucket.

Parameters
  • dataset (str) – Dataset trained on.

  • model (str) – Model name.

Return type

Model

Returns

Pretrained tensorflow model.

alibi_detect.utils.fetching.fetch_vae(url, filepath)[source]

Download VAE outlier detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.fetch_vaegmm(url, filepath)[source]

Download VAEGMM outlier detector.

Parameters
  • url (str) – URL to fetch detector from.

  • filepath (Union[str, PathLike]) – Local directory to save detector to.

Return type

None

alibi_detect.utils.fetching.get_pixelcnn_default_kwargs()[source]