Module

pycaret.plots.anomaly

Plotly-native anomaly-detection diagnostics.

Functions:

  • score_distribution — histogram of anomaly scores with the detection threshold marked.
  • anomaly_map — 2-D scatter colored by anomaly flag (PCA / t-SNE / UMAP).
  • feature_anomaly_scatter — pick two features, scatter raw data colored by anomaly status.
  • score_vs_feature — anomaly score against a feature value (helps identify which features drive anomaly).

Functions 4

score_distribution(estimator: Any, X: Any, threshold: float | None = None, nbins: int = 60, title: str | None = 'Anomaly score distribution') -> go.Figure

Histogram of anomaly scores with the detection threshold marked.

anomaly_map(estimator: Any, X: Any, method: str = 'pca', sample: int | None = 2000, random_state: int = 0, title: str | None = None) -> go.Figure

2-D embedding of X colored by anomaly flag (red = anomaly).

Methods: pca (default), tsne, umap (optional dep).

feature_anomaly_scatter(estimator: Any, X: Any, feature_x: str | int, feature_y: str | int, feature_names: list[str] | None = None, title: str | None = None) -> go.Figure

Scatter of two raw features colored by anomaly status.

More interpretable than the embedding map when the user knows which features are likely to drive anomaly (e.g. transaction_amount vs. time_of_day).

score_vs_feature(estimator: Any, X: Any, feature: str | int, feature_names: list[str] | None = None, title: str | None = None) -> go.Figure

Anomaly score against a feature value. Anomaly cluster shape reveals which feature ranges drive detection.