DiscretizationResult#

class superglm.DiscretizationResult(tables: dict[str, ~pandas.DataFrame], predictions: ~numpy._typing._array_like.NDArray, original_predictions: ~numpy._typing._array_like.NDArray, metrics: dict[str, float], interaction_tables: dict[str, ~pandas.DataFrame] = <factory>, band_diagnostics: dict[str, dict[str, float]] = <factory>)#

Bases: object

Result of discretizing smooth spline curves into rating tables.

Attributes:
tablesdict[str, DataFrame]

Per-MAIN-EFFECT rating tables with columns: bin_from, bin_to, relativity, log_relativity, n_obs, sample_weight. n_obs is always the physical row count. sample_weight is the supplied weight total in the bin – replication mass under the frequency contract, precision mass under the prior one – and is reported for display rather than reinterpreted as a count under either reading.

interaction_tablesdict[str, DataFrame]

Per-INTERACTION grids, one row per grid cell, with two axis-value columns named for the parents – suffixed (axis 1)/(axis 2) when the parent names would collide with each other or with a value column – and then relativity, log_relativity, n_obs and sample_weight on the same terms as tables. Kept in its own mapping because the two shapes are not interchangeable: a main effect is binned into intervals and a continuous-by-continuous interaction is SAMPLED at grid nodes, so it has axis values where a bin has a half-open interval, and one row per cell rather than per bin.

predictionsNDArray

Predictions using discretized (binned) curves.

original_predictionsNDArray

Original smooth predictions.

metricsdict[str, float]

Comparison metrics between original and discretized predictions. Joint over everything discretized in the call, main effects and interactions alike, since that is the prediction a consumer of the whole table gets.

band_diagnosticsdict[str, dict[str, float]]

Per main effect banded with bin_strategy="exact": bands, tolerance_factor (1.0 unless n_bins forced a wider limit), worst_error and mean_error (relative error of the band factor against the curve, |band / curve - 1|, the mean weighted by geometry mass) and worst_error_se (the largest gap in standard errors). Empty for the other strategies. The standard errors are the term’s own under its centring, so they narrow where the curve crosses its weighted mean and bands can bunch there.