abdulfatir / abdulfatir/IWAE-tensorflow

Loss function seems to be miscalculated

オープン
#2 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
4
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

説明

Thank you for your implementation of IWAE. Although I have one remark and one question about it:
### The remark:
Your training loss function in ```iwae.py``` lines 71-73 seems miscalculated to me:
```python
loss = - \
tf.reduce_mean(tf.reduce_sum(
normalized_weights * log_weights, 0))
```
There seems to be a confusion between the loss function and the gradient estimate given in the paper. You seem to be trying to apply the trick in the paper that uses the normalization weights to keep gradient calculations parallel w.r.t the k samples of z despite the log. However, if so, you should stop the gradient at ```normalized_weights``` because they are only meant to weight the gradients, and not to be differentiated. Here is the gradient estimate I am referring to :
![image](https://user-images.githubusercontent.com/25091538/71582542-fc40e480-2b0a-11ea-994a-788029fc6f81.png)

### The question :
I can see that, while calculating the weights you substract the maximum weight w.r.t the k samples of z as follows:
```python
weights = tf.exp(log_weights - tf.reduce_max(log_weights, 0))
```
I can also see that you somehow "put them back" after applying the average log when testing. I have seen a similar trick in the original implementation. I tried googling for the reason behind this trick using various keywords but I can't seem to find it. Could you please give me a quick explanation for this or direct me towards a resource that explains it.

Thanks again for your hard work on this implementation, as well as for your answers to my questions.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。