# Mean Poisson Deviance

> Compute the mean_poisson_deviance metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute mean_poisson_deviance, or asks how to score with mean_poisson_deviance.

- Skill: `qhjqhj00/mean-poisson-deviance` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/mean-poisson-deviance`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/mean-poisson-deviance/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/mean-poisson-deviance

---


# mean-poisson-deviance

> Metric `mean_poisson_deviance` from `scikit-learn` (sklearn.metrics.mean_poisson_deviance)

## When to invoke this skill

The user has predictions + ground truth and asks to evaluate with mean_poisson_deviance, or
mentions `sklearn.metrics.mean_poisson_deviance` directly, or wants the standard scikit-learn implementation.

## Reference signature

```python
from sklearn.metrics import mean_poisson_deviance

# mean_poisson_deviance(y_true, y_pred, *, sample_weight=None)
```

## Library docstring

```
Mean Poisson deviance regression loss.

Poisson deviance is equivalent to the Tweedie deviance with
the power parameter `power=1`.

Read more in the :ref:`User Guide <mean_tweedie_deviance>`.

Parameters
----------
y_true : array-like of shape (n_samples,)
    Ground truth (correct) target values. Requires y_true >= 0.

y_pred : array-like of shape (n_samples,)
    Estimated target values. Requires y_pred > 0.

sample_weight : array-like of shape (n_samples,), default=None
    Sample weights.

Returns
-------
loss : float
    A non-negative floating point value (the best value is 0.0).

Examples
--------
>>> 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...
```

## Quick recipe

```python
import sklearn.metrics as _m
score = _m.mean_poisson_deviance(y_true, y_pred)
```

## Don'ts

- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.

