Plot all anomaly projections (PCA and UMAP comparison)
Source:R/anomaly_plot.R
plot_anomaly_projection_all.RdCreate a comparison plot showing both PCA and UMAP projections of the same data, making it easy to see how different dimensionality reduction methods reveal anomalies. For large datasets, automatic sampling is applied to improve speed.
Usage
plot_anomaly_projection_all(
model,
data,
method = "mtt",
contamination = 0.05,
point_size = 2,
point_alpha = 0.6,
umap_n_neighbors = 15,
umap_min_dist = 0.1,
sample_rate = 0.05
)Arguments
- model
An isoForest model object
- data
The original data (must be numeric)
- method
Threshold method for anomaly detection (default: "mtt")
- contamination
Contamination rate (only used if method = "contamination")
- point_size
Size of points in the plot (default: 2)
- point_alpha
Transparency of points (default: 0.6)
- umap_n_neighbors
Number of neighbors for UMAP (default: 15)
- umap_min_dist
Minimum distance for UMAP (default: 0.1)
- sample_rate
Target anomaly rate in the displayed data (default: 0.05). Set to NULL to disable sampling.