Expand description
Metric-vs-metric correlation and divergence analysis for the viser
video-encoding-optimizer workspace.
Where viser_quality computes each metric, this crate compares the
metrics against each other: how strongly PSNR, SSIM, VMAF, SSIMULACRA2 and
butteraugli agree on the same content — via Pearson, Spearman (SROCC) and
Kendall tau-b (KROCC) — and which samples they most disagree about
(divergence detection).
A “sample” is whatever the aligned series share: per-frame scores within one
clip, or one aggregate score per encode across a ladder. The core functions
are metric-agnostic and operate on &[f64]; series_from_frames is a
convenience bridge from viser_quality::FrameResult.
use viser_metrics::{MetricSeries, correlation_matrix};
let series = vec![
MetricSeries::new("vmaf", vec![80.0, 85.0, 90.0], true),
MetricSeries::new("psnr", vec![37.0, 38.0, 40.0], true),
];
let m = correlation_matrix(&series);
assert!((m.spearman[0][1] - 1.0).abs() < 1e-9); // perfectly monotonicStructs§
- Correlation
Matrix - Pairwise correlation matrices across a set of labelled metric series.
- Divergence
- A sample the metrics disagree about, with its per-metric normalized quality.
- Metric
Series - One metric’s values across an aligned set of samples (frames or encodes).
Functions§
- correlation_
matrix - Compute pairwise Pearson/Spearman/Kendall correlation across all series.
- divergences
- Rank samples by how much the metrics disagree about them, worst (largest spread) first.
- kendall_
tau - Kendall tau-b rank correlation (KROCC), corrected for ties.
- pearson
- Pearson product-moment correlation of two equal-length series.
- series_
from_ frames - Build per-metric series from per-frame quality results.
- spearman
- Spearman rank correlation (SROCC) — Pearson on tie-averaged ranks.