title: How do you visualize or graph real-time training/testing data in machine learning?
body: <p><strong><em>In short I want to be able to visualize both train/test data as it's learning in real-time</em></strong></p>
  
  <blockquote>
    <p>below is how I'm currently visualizing the progress:</p>
  
  <pre><code>batch_size = 100
  epochs = 30
  init = tf.global_variables_initializer()
  samples = []
  
  with tf.Session() as sess:    
      sess.run(init)    
          for epoch in range(epochs):        
          num_batches = mnist.train.num_examples // batch_size
  
          for i in range(num_batches):            
              batch = mnist.train.next_batch(batch_size)            
              batch_images = batch[0].reshape((batch_size, 784))
              batch_images = batch_images * 2 -1            
              batch_z = np.random.uniform(-1,1,size=(batch_size, 100))
  
              _ = sess.run(D_trainer, feed_dict={real_images:batch_images,    
                                                 z:batch_z})
              _ = sess.run(G_trainer, feed_dict={z:batch_z})
          print("ON EPOCH {}".format(epoch))
  
          sample_z = np.random.uniform(-1,1, size=(1, 100))
          gen_samples = sess.run(generator(z, reuse=True),
                                 feed_dict={z:sample_z})    
          samples.append(gen_samples)
  
  new_samples = []
  #saver = tf.train.Saver(var_list=g_vars)
  
  with tf.Session() as sess:   
      #saver.restore(sess,"...")
  
      for x in range(5):
          sample_z = np.random.uniform(-1,1, size=(1, 100))
          gen_samples = sess.run(generator(z, reuse=True),
                                 feed_dict={z:sample_z})        
          new_samples.append(gen_samples)       
  plt.imshow(new_samples[0].reshape(28,28))
  </code></pre>
    
    <p>This is how I visualize my graph real-time for sentiment analysis by
    running it on a separate terminal.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  from matplotlib import style
  import time
  
  style.use("ggplot")
  
  fig = plt.figure()
  ax1 = fig.add_subplot(1,1,1)
  
  def animate(i):
      pullData = open("twitter-out.txt","r").read()
      lines = pullData.split('\n')
  
      xar = []
      yar = []
  
      x = 0
      y = 0
  
      for l in lines[-200:]:
          x += 1
          if "pos" in l:
              y += 1
          elif "neg" in l:
              y -= 1
  
          xar.append(x)
          yar.append(y)
  
      ax1.clear()
      ax1.plot(xar,yar)
  ani = animation.FuncAnimation(fig, animate, interval=1000)
  plt.show()
  </code></pre>
  </blockquote>
  
  <p><strong><em>I have also attached a Youtube link below to further provide clarity to the problem that I'm having. I want to be able to see and hear images/speech as it's being trained.</em></strong>  </p>
  
  <p><a href="https://www.youtube.com/watch?v=vq2nnJ4g6N0" rel="nofollow noreferrer">Starts at 1:10:23 - 1:11:03</a></p>
  
  <p><a href="https://www.youtube.com/watch?v=NG-LATBZNBs" rel="nofollow noreferrer">Generating Real-time RNN-LSTM</a></p>