Metrics#

Metrics are scalar aggregations computed per numerical column when generating a summary(). Pass them via the metrics argument as a mapping from display label to a MetricFn callable. diffly.metrics ships a set of presets; you can also supply your own callable (left_expr, right_expr) -> pl.Expr.

diffly.metrics.MetricFn#

A metric function maps (left_expr, right_expr) to a scalar aggregation expression.

The expressions refer to the left-side and right-side values of a single column across all joined rows.

alias of Callable[[Expr, Expr], Expr]

Presets#

mean(left, right)

Mean of right - left.

median(left, right)

Median of right - left.

min(left, right)

Minimum of right - left.

max(left, right)

Maximum of right - left.

std(left, right)

Standard deviation of right - left.

mean_absolute_deviation(left, right)

Mean of |right - left|.

mean_relative_deviation(left, right)

Mean of |(right - left) / left|.

quantile(q)

Factory returning a metric that computes the q-quantile of right - left.