File size: 599 Bytes
5125f12 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|