alibi_detect.utils.saving module

alibi_detect.utils.saving.init_ad_vae(state_dict, vae, model)[source]

Initialize AdversarialVAE.

Parameters
  • state_dict (Dict) – Dictionary containing the parameter values.

  • vae (tensorflow.keras.Model) – Loaded VAE.

  • model (tensorflow.keras.Model) – Loaded classification model.

Return type

AdversarialVAE

Returns

Initialized AdversarialVAE instance.

alibi_detect.utils.saving.init_od_aegmm(state_dict, aegmm)[source]

Initialize OutlierAEGMM.

Parameters
  • state_dict (Dict) – Dictionary containing the parameter values.

  • aegmm (tensorflow.keras.Model) – Loaded AEGMM.

Return type

OutlierAEGMM

Returns

Initialized OutlierAEGMM instance.

alibi_detect.utils.saving.init_od_iforest(state_dict)[source]

Initialize isolation forest.

Parameters

state_dict (Dict) – Dictionary containing the parameter values.

Return type

IForest

Returns

Initialized IForest instance.

alibi_detect.utils.saving.init_od_mahalanobis(state_dict)[source]

Initialize Mahalanobis.

Parameters

state_dict (Dict) – Dictionary containing the parameter values.

Return type

Mahalanobis

Returns

Initialized Mahalanobis instance.

alibi_detect.utils.saving.init_od_prophet(state_dict)[source]

Initialize OutlierProphet.

Parameters

state_dict (Dict) – Dictionary containing the parameter values.

Return type

OutlierProphet

Returns

Initialized OutlierProphet instance.

alibi_detect.utils.saving.init_od_sr(state_dict)[source]

Initialize spectral residual detector.

Parameters

state_dict (Dict) – Dictionary containing the parameter values.

Return type

SpectralResidual

Returns

Initialized SpectralResidual instance.

alibi_detect.utils.saving.init_od_vae(state_dict, vae)[source]

Initialize OutlierVAE.

Parameters
  • state_dict (Dict) – Dictionary containing the parameter values.

  • vae (tensorflow.keras.Model) – Loaded VAE.

Return type

OutlierVAE

Returns

Initialized OutlierVAE instance.

alibi_detect.utils.saving.init_od_vaegmm(state_dict, vaegmm)[source]

Initialize OutlierVAEGMM.

Parameters
  • state_dict (Dict) – Dictionary containing the parameter values.

  • vaegmm (tensorflow.keras.Model) – Loaded VAEGMM.

Return type

OutlierVAEGMM

Returns

Initialized OutlierVAEGMM instance.

alibi_detect.utils.saving.load_detector(filepath)[source]

Load outlier or adversarial detector.

Parameters

filepath (str) – Load directory.

Return type

Union[BaseDetector, AdversarialVAE, IForest, Mahalanobis, OutlierAEGMM, OutlierProphet, OutlierVAE, OutlierVAEGMM, SpectralResidual]

Returns

Loaded outlier or adversarial detector object.

alibi_detect.utils.saving.load_tf_aegmm(filepath, state_dict)[source]

Load AEGMM.

Parameters
  • filepath (str) – Save directory.

  • state_dict (Dict) – Dictionary containing the n_gmm and recon_features parameters.

Return type

tensorflow.keras.Model

Returns

Loaded AEGMM.

alibi_detect.utils.saving.load_tf_model(filepath)[source]
Return type

tensorflow.keras.Model

alibi_detect.utils.saving.load_tf_vae(filepath, state_dict)[source]

Load VAE.

Parameters
  • filepath (str) – Save directory.

  • state_dict (Dict) – Dictionary containing the latent dimension and beta parameters.

Return type

tensorflow.keras.Model

Returns

Loaded VAE.

alibi_detect.utils.saving.load_tf_vaegmm(filepath, state_dict)[source]

Load VAEGMM.

Parameters
  • filepath (str) – Save directory.

  • state_dict (Dict) – Dictionary containing the n_gmm, latent_dim and recon_features parameters.

Return type

tensorflow.keras.Model

Returns

Loaded VAEGMM.

alibi_detect.utils.saving.save_detector(detector, filepath)[source]

Save outlier or adversarial detector.

Parameters
Return type

None

alibi_detect.utils.saving.save_tf_aegmm(od, filepath)[source]

Save TensorFlow components of OutlierAEGMM.

Parameters
  • od (OutlierAEGMM) – Outlier detector object.

  • filepath (str) – Save directory.

Return type

None

alibi_detect.utils.saving.save_tf_model(model, filepath)[source]

Save TensorFlow model.

Parameters
  • model (tensorflow.keras.Model) – A tf.keras Model.

  • filepath (str) – Save directory.

Return type

None

alibi_detect.utils.saving.save_tf_vae(detector, filepath)[source]

Save TensorFlow components of OutlierVAE or AdversarialVAE.

Parameters
Return type

None

alibi_detect.utils.saving.save_tf_vaegmm(od, filepath)[source]

Save TensorFlow components of OutlierVAEGMM.

Parameters
  • od (OutlierVAEGMM) – Outlier detector object.

  • filepath (str) – Save directory.

Return type

None

alibi_detect.utils.saving.state_adv_vae(ad)[source]

AdversarialVAE parameters to save.

Parameters

ad (AdversarialVAE) – Adversarial detector object.

Return type

Dict

alibi_detect.utils.saving.state_aegmm(od)[source]

OutlierAEGMM parameters to save.

Parameters

od (OutlierAEGMM) – Outlier detector object.

Return type

Dict

alibi_detect.utils.saving.state_iforest(od)[source]

Isolation forest parameters to save.

Parameters

od (IForest) – Outlier detector object.

Return type

Dict

alibi_detect.utils.saving.state_mahalanobis(od)[source]

Mahalanobis parameters to save.

Parameters

od (Mahalanobis) – Outlier detector object.

Return type

Dict

alibi_detect.utils.saving.state_prophet(od)[source]

OutlierProphet parameters to save.

Parameters

od (OutlierProphet) – Outlier detector object.

Return type

Dict

alibi_detect.utils.saving.state_sr(od)[source]

Spectral residual parameters to save.

Parameters

od (SpectralResidual) – Outlier detector object.

Return type

Dict

alibi_detect.utils.saving.state_vae(od)[source]

OutlierVAE parameters to save.

Parameters

od (OutlierVAE) – Outlier detector object.

Return type

Dict

alibi_detect.utils.saving.state_vaegmm(od)[source]

OutlierVAEGMM parameters to save.

Parameters

od (OutlierVAEGMM) – Outlier detector object.

Return type

Dict