Metrics poissondeviance score - CyrilB1531/lodestar GitHub Wiki
Development build. This page describes
main, not a released package. The latest published Lodestar.Metrics is 0.3.0 โ read its documentation.
Home โบ Metrics โบ Regression metrics
The mean Poisson deviance โ sklearn.metrics.mean_poisson_deviance.
public static double Score(ReadOnlySpan<double> yTrue, ReadOnlySpan<double> yPred, ReadOnlySpan<double> sampleWeight = default)Parameters โ yTrue is the true counts, which must be non-negative, and yPred the predicted
rates, which must be strictly positive and the same length. sampleWeight is one weight per sample,
or empty โ the default โ to weight every sample by 1.
Returns โ double, 0 for a perfect prediction and larger the worse it is. Unbounded above.
Exceptions โ ArgumentException when the lengths disagree, the input is empty or holds a
non-finite value, a truth is negative, or a prediction is not strictly positive. The message is
scikit-learn's, and names power=1: this is TweedieDeviance at that power
and shares its refusal.
Example โ four counts against a model's predicted rates.
using Lodestar.Metrics;
double[] counts = [1.0, 2.0, 3.0, 4.0];
double[] rates = [1.5, 2.5, 2.0, 4.5];
double deviance = PoissonDeviance.Score(counts, rates); // => 0.1967โฆA zero count is fine, and contributes only the ลท โ y part of the term:
using Lodestar.Metrics;
double[] counts = [0.0, 2.0, 3.0];
double[] rates = [1.0, 2.0, 3.0];
double withZero = PoissonDeviance.Score(counts, rates); // => 0.6666โฆRemarks โ identical to TweedieDeviance.Score at power: 1.0,
asserted across the whole frozen corpus rather than on one pair.
Applies to โ net10.0, netstandard2.0.
See also โ GammaDeviance.Score,
TweedieDeviance.Score, D2Tweedie.Score, the
Python equivalence table.