tf.keras.losses.Poisson 损失函数 示例

泊松损失函数

预测值为为 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)=n1i=1n(PiTilog(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

猜你喜欢

转载自blog.csdn.net/weixin_44493841/article/details/121515235