泊松损失函数
预测值为为 P P P ,真实值 T T T 。
p o i s s o n ( P , T ) = 1 n ∑ i = 1 n ( P i − T i l o g ( P i ) ) poisson(P,T)=\frac{1}{n}\sum_{i=1}^{n}(P_{i}-T_{i}log(P_{i})) poisson(P,T)=n1∑i=1n(Pi−Tilog(Pi))
import tensorflow as tf
y_true = [[0., 1.], [0., 0.]]
y_pred = [[1., 1.], [0., 0.]]
# Using 'auto'/'sum_over_batch_size' reduction type.
p = tf.keras.losses.Poisson()
p(y_true, y_pred).numpy()
0.49999997