title: implement custom loss function based on reconstructed output of neural network?
body: <p>I am trying to perform blind source separation using neural networks. I've tried using auto-encoders with different regularization/dropouts, but nothing seems to work.</p>
  
  <p>Now, i've decided to move to implementing a custom loss function based on the reconstructed output. There are a couple i can use, such as correlation between output vectors (which should be minimized), or non-gaussianity of output vectors (which should be maximized).</p>
  
  <p>However, I don't know how to do this in keras, or if its even possible. Basically, this is what I want to do:</p>
  
  <ol>
  <li><p>feed my linearly mixed signals into the input of the network</p></li>
  <li><p>have a few hidden layers where the signals can be re-combined according to various weights of the network</p></li>
  <li><p>every training step, reconstruct the output of my network, and compute statistics on the reconstructed outputs, then add these to my cost function, so for example if all my reconstructed outputs are highly correlated, I would penalize that weight combination, hoping for a set of weights in the future that would lead to decorrelated outputs (thus solving the blind source separation problem).</p></li>
  </ol>
  
  <p>Does anyone know how to do this in keras? I don't mind moving to Tensorflow but would prefer to stay in Keras.</p>
  
  <p>Thanks</p>