mean_poisson_deviance#

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

平均 Poisson 偏差回归损失。

泊松偏差(Poisson deviance)等同于参数 power=1 的 Tweedie deviance。

用户指南中了解更多信息。

参数:
y_true形状为 (n_samples,) 的 array-like

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

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

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

sample_weightshape 为 (n_samples,) 的 array-like, default=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...