0
$\begingroup$

I'm trying to plot my test set and test set predictions to check the differences and see how my autoencoder reconstructed the data, but since I have a test set 30x10 I have a huge visualization problem: enter image description here

How can I solve it? This is the code, I'm just showing the first row (X-test[0]), but I have 29 more and I don't how to show all of them properly.

fig = plt.figure()
plt.plot(X_test[0].T, label='y_true')
plt.plot(x_test_pred[0].T, label='yhat_conv')
_ = plt.legend()
plt.show()
plt.close()
$\endgroup$
5
  • $\begingroup$ Could you give us the shapes of X_test so that we can maybe synthetically reproduce the plot? $\endgroup$
    – PSub
    Mar 19 at 3:16
  • 1
    $\begingroup$ What about plotting the differences - i.e. y_true - yhat_conv (or the other way round) ... basically they look like they are going to have a small'ish variance .. $\endgroup$
    – Mr R
    Mar 19 at 6:37
  • $\begingroup$ And offset a few of them (i.e. add 3 to some of the differences and 6 to some more - if you can control the colours pick them too to make pairs line up easily but be visually different [so you only end up with 2/3 per line row of differences instead of 10]... $\endgroup$
    – Mr R
    Mar 19 at 6:40
  • 1
    $\begingroup$ Or eliminate all the ones where the difference is really low and only look at the "worst" ?? $\endgroup$
    – Mr R
    Mar 19 at 6:40
  • $\begingroup$ @PSub The shape of X_test is (3000, 10, 30) $\endgroup$
    – Fabio
    Mar 19 at 6:47
1
$\begingroup$

It's not going to be pretty, but you just for-loop your code:

ax, fig = plt.subplots()
for i in range(30):
    ax.plot(X_test[i].T, label='y_true_' + i)
    ax.plot(x_test_pred[i].T, label='yhat_conv' + i)
plt.show()

Because you have so many lines, it would be best to remove the legend from the plot as it will be too much information to interpret. You could use additional subplots e.g. ax,fig = plt.subplots(5,6) and plot one row on each subplot e.g. ax[1].plot(first_plot) etc.

It might be more suitable to generate some summary statistics or differences of the lines (as suggested in the comments). One way would also to plot the error bars/distributions of the lines as shaded regions and just the line of the average for particular groups, similar to the plot below:

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.