Compute the mean_gamma_deviance metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute mean_gamma_deviance, or asks how to score with mean_gamma_deviance.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add qhjqhj00/research-skills-pool --skill mean-gamma-deviance --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Mean Gamma Deviance?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-mean-gamma-deviance)More formats (shields.io, HTML) on the badges page.
---
name: mean-gamma-deviance
description: Compute the mean_gamma_deviance metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute mean_gamma_deviance, or asks how to score with mean_gamma_deviance.
metadata:
skill_kind: metric
source_lib: scikit-learn
import_path: sklearn.metrics.mean_gamma_deviance
source: library_introspection
---
# mean-gamma-deviance
> Metric `mean_gamma_deviance` from `scikit-learn` (sklearn.metrics.mean_gamma_deviance)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with mean_gamma_deviance, or
mentions `sklearn.metrics.mean_gamma_deviance` directly, or wants the standard scikit-learn implementation.
## Reference signature
```python
from sklearn.metrics import mean_gamma_deviance
# mean_gamma_deviance(y_true, y_pred, *, sample_weight=None)
```
## Library docstring
```
Mean Gamma deviance regression loss.
Gamma deviance is equivalent to the Tweedie deviance with
the power parameter `power=2`. It is invariant to scaling of
the target variable, and measures relative errors.
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_gamma_deviance
>>> y_true = [2, 0.5, 1, 4]
>>> y_pred = [0.5, 0.5, 2., 2.]
>>> mean_gamma_deviance(y_true, y_pred)
1.0568...
```
## Quick recipe
```python
import sklearn.metrics as _m
score = _m.mean_gamma_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)`.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!