title: Keras - Variational Autoencoder NaN loss
body: <p>I'm trying to use the implementation of Variational Autoencoder that I found among the Keras examples (<a href="https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py" rel="noreferrer">https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py</a>).</p>
  
  <p>I just refactored the code in order to use it more easily from a Jupyter notebook (my code: <a href="https://github.com/matbell/Autoencoders/blob/master/models/vae.py" rel="noreferrer">https://github.com/matbell/Autoencoders/blob/master/models/vae.py</a>).</p>
  
  <p>However, when I try to fit the model on my data I get the following output:</p>
  
  <pre><code>Autoencoders/models/vae.py:69: UserWarning: Output "dense_5" missing from loss dictionary. We assume this was done on purpose, and we will not be expecting any data to be passed to "dense_5" during training.
  self.vae.compile(optimizer='rmsprop')
  
  Train on 15474 samples, validate on 3869 samples
  Epoch 1/50
  15474/15474 [==============================] - 1s 76us/step - loss: nan - val_loss: nan
  Epoch 2/50
  15474/15474 [==============================] - 1s 65us/step - loss: nan - val_loss: nan
  Epoch 3/50
  15474/15474 [==============================] - 1s 69us/step - loss: nan - val_loss: nan
  Epoch 4/50
  15474/15474 [==============================] - 1s 62us/step - loss: nan - val_loss: nan
  </code></pre>
  
  <p>and the loss remains the same for all the training epochs.</p>
  
  <p>I'm not so expert in Deep Learning and Neural Networks fields, so maybe I'm missing something....</p>
  
  <p>This is the input data, where <code>data</code> and <code>labels</code> are two <code>pandas.DataFrame</code>.</p>
  
  <pre><code>In: data.shape
  Out: (19343, 87)
  
  In: label.shape
  Out: (19343, 1)
  </code></pre>
  
  <p>And this is how I use the <code>Vae</code> class (from my code) in Jupyter notebook:</p>
  
  <pre><code>INPUT_SIZE = len(data.columns)
  X_train, X_test, y_train, y_test = train_test_split(data, labels, test_size = 0.2)
  
  vae = Vae(INPUT_SIZE, intermediate_dim=32)
  vae.fit(X_train, X_test)
  </code></pre>
  
  <p>Thanks for any help!</p>