mean_poisson_deviance#

sklearn.metrics.mean_poisson_deviance(y_true, y_pred, *, sample_weight=None)[source]#

平均泊松离差回归损失。

泊松离差等效于幂参数 power=1 的 Tweedie 离差。

用户指南中了解更多。

参数:
y_true形状为 (n_samples,) 的类数组

真实(正确)目标值。要求 y_true >= 0。

y_pred形状为 (n_samples,) 的类数组

估计目标值。要求 y_pred > 0。

sample_weight形状为 (n_samples,) 的类数组,默认为 None

样本权重。

返回:
loss浮点数

一个非负浮点值(最佳值为 0.0)。

示例

>>> from sklearn.metrics import mean_poisson_deviance
>>> y_true = [2, 0, 1, 4]
>>> y_pred = [0.5, 0.5, 2., 2.]
>>> mean_poisson_deviance(y_true, y_pred)
1.4260...