0

I am trying to plot in a scatter format some data I have predicted with the decoder of a VAE I've developed.

This might be very basic. However, I would like to know how should I plot the array I've predicted with a scatterplot.

new_data = vae.decoder.predict(np.random.normal(0,1,size=(1, latent_dim, 1)))

array([[[0.4776226 ],
    [0.47153735],
    [0.4817254 ],
    [0.48054865],
    [0.45594737],
    [0.48623624],
    [0.47953185],
    [0.47151   ],
    [0.4822226 ],
    [0.46702865],
    [0.50809085]]], dtype=float32)

I am using this question. However when I do: df = pd.DataFrame(new_data) I get: ValueError: Must pass 2-d input. shape=(1, 11, 1) Which is the proper way to plot this using Seaborn?

eneko valero
  • 457
  • 3
  • 14
  • 1
    You have an array of 11elements, if this is only the y-axis data and the x-axis is 1,2,3..you just need to plot it (maybe use flatten), if the x-axis value should be different, it is missing... You dont need to use pandas – Kings85 Apr 13 '22 at 14:57
  • 1
    By the way, this question is not related not to tensorflow not to keras and not to VAE.. maybe you should consider editing your question – Kings85 Apr 13 '22 at 15:00

1 Answers1

1

Your data is currently a 3d array and it requires a 2d array, so you will need to reshape your array:

new_data = vae.decoder.predict(np.random.normal(0,1,size=(1, latent_dim, 1)))
reshaped_data = new_data.reshape((1, 11))
DPM
  • 845
  • 7
  • 33