回答編集履歴
1
修正
answer
CHANGED
@@ -4,4 +4,12 @@
|
|
4
4
|
|
5
5
|
実装の話であれば、こちらでコードを見れます。
|
6
6
|
|
7
|
-
[torch.distributions.categorical — PyTorch master documentation](https://pytorch.org/docs/stable/_modules/torch/distributions/categorical.html#Categorical.log_prob)
|
7
|
+
[torch.distributions.categorical — PyTorch master documentation](https://pytorch.org/docs/stable/_modules/torch/distributions/categorical.html#Categorical.log_prob)
|
8
|
+
|
9
|
+
## 追記
|
10
|
+
|
11
|
+
> multinomialを使っているので基本的には並べ替えを変えているようですが、それだけでしょうか。
|
12
|
+
|
13
|
+
カテゴリカル分布は、多項分布で N = 1 とした場合なので、`torch.multinomial(probs_2d, 1, True)` で計算しています。
|
14
|
+
|
15
|
+
[ややこしい離散分布に関するまとめ - 作って遊ぶ機械学習。](http://machine-learning.hatenablog.com/entry/2016/03/26/211106)
|