温度付きsoftmax (softmax with temperature) いつ使うか モデルの蒸留なんかに出てくる損失関数 (多分他にも出てくるんだろうけどあまり知らない). 「ちょっと高い確率で出てきたクラスを重視して学習したい!」とか「低い確率のクラスを切り捨てずに学習したい!」ときに使われる. 数式 $$ S(y_i)=\frac{e^{\frac{y_i}{T}}}{\Sigma{e^{\frac{y_k}{T}}}} $$ 実装(Chainer) import chainer import numpy as np def softmax_with_temperature(x, temperature: float) -> chainer.Variable: return F.softmax(x / temperature) softmax_with_temperature(n

