plot tool updates

This commit is contained in:
Jan Kowalczyk
2025-08-13 14:15:38 +02:00
parent 37ac637c9c
commit a936b754cb
3 changed files with 10 additions and 42 deletions

View File

@@ -78,11 +78,19 @@ def plot_tsne_latent_space(normal_data, anomaly_data, title="TSNE of Latent Spac
Plot the TSNE representation of the latent space.
This function first applies a PCA-based dimensionality reduction for efficiency.
"""
# Hardcoded variables to choose every nth normal sample and mth anomaly sample
n = 10 # Change this value to select every nth normal sample
m = 2 # Change this value to select every mth anomaly sample
# Select every nth normal sample and mth anomaly sample
normal_data = normal_data[::n]
anomaly_data = anomaly_data[::m]
# Combine normal and anomaly data
combined_data = np.vstack((normal_data, anomaly_data))
# Initial dimensionality reduction with PCA
reduced_data = reduce_dimensionality(combined_data, n_components=50)
reduced_data = reduce_dimensionality(combined_data, n_components=100)
# Apply TSNE transformation on the PCA-reduced data
tsne = TSNE(n_components=2, random_state=42)