import matplotlib.pyplot as plt import seaborn as sns import numpy as np def plot_scores(scores, outpath): plt.figure(figsize=(12,3)) plt.plot(scores, linewidth=1) plt.title('Anomaly scores over time') plt.xlabel('Window index') plt.ylabel('Score') plt.tight_layout() plt.savefig(outpath) plt.close() def plot_heatmap(saliency, outpath): # saliency: seq_len x channels plt.figure(figsize=(8,4)) sns.heatmap(saliency.T, cmap='viridis') plt.xlabel('Time step') plt.ylabel('Channel') plt.tight_layout() plt.savefig(outpath) plt.close()