arXiv Science⌕ Search

arXiv · 2611.37578

When is simple target encoding optimal? Moment exactness for sparse categorical features, and the limits of estimating their information

Abstract

Target encoding replaces each level of a high-cardinality categorical feature by a smoothed estimate of the target rate. We ask how well any encoder can do when most test rows fall on levels seen zero, one or two times, what a simple encoder misses on real data, and whether the information $I(X;Y)$ the feature carries can be estimated in this regime. The Bayes prediction after $n$ observations depends only on the first $n+1$ moments of the prior. Hence, when a level's target rate does not depend on its popularity (exchangeability), a beta prior matched to two moments is exactly the oracle on levels seen at most once, and type-II maximum likelihood recovers it asymptotically when no level is seen more than twice. A moment test rejects exchangeability on 21 of 23 real features. Without it, the oracle prior for levels seen $n$ times is the law of the target rate among levels seen $n+1$ times; this shift yields a correction read off the singleton and doubleton counts, and a frequency-aware prior that closes half to four-fifths of the remaining gap on real-data subsampling oracles. Information is harder: from levels seen at most $L$ times, $I(X;Y)$ is only partially identified, within a worst-case half-width of 0.038 nats for $L=2$ and about $0.22/L^2$ for larger even $L$, and without exchangeability only a trivial bound holds for the singletons' share. On 24 real features, fitted priors (beta, NPMLE, GLMM, frequency-aware) differ by less than 0.01 nats per test row; larger losses come from a fixed smoothing strength far from the fitted one, such as the common default $m=20$, and from predicting a GLMM at its mode. A likelihood-region interval for $I(X;Y)$ covers in our synthetic studies and on all but one exchangeable real pool; on real features, stratified identified intervals are several hundredths of a nat wide, and up to 0.45 nats on the sparsest.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Damián G. Hernández. 2026-11-27. When is simple target encoding optimal? Moment exactness for sparse categorical features, and the limits of estimating their information. https://arxiv.science/abs/2611.37578

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

A unifying Bayesian framework for adversarial robustness

The vulnerability of machine learning models to adversarial attacks remains a critical societal security challenge. Yet the defense of Bayesian predictive models has received little attention, even though their attack surface is wider: an adversary may corrupt not only their predictions but also the uncertainty they quantify. Moreover, traditional defenses, such as adversarial training, typically robustify models by minimizing a worst-case loss. These deterministic approaches do not account for uncertainty in the adversary's attack. While stochastic defenses placing a probability distribution on the adversary exist, they often lack statistical rigor and fail to make explicit their underlying assumptions. Our aim is thus twofold: to protect Bayesian predictive models, and to do it in a Bayesian way, explicitly modeling uncertainty about the attacker. To this end, we introduce a formal Bayesian framework for adversarial robustness that captures adversarial uncertainty through a stochastic channel and makes every probabilistic assumption explicit. This yields two robustification strategies that protect the entire posterior predictive distribution: a proactive defense enacted during training, aligned with adversarial training, and a reactive defense enacted during operations, aligned with adversarial purification. Several state-of-the-art defenses can be recovered as limiting cases of the proposed framework. Consistent with this wider attack surface, our experiments assess both accuracy and the quality of predictive uncertainty under attack, and showcase the benefits of explicitly modeling adversarial uncertainty.

stat.ML↗

Learning with the Nash-Sutcliffe loss

Relative measures are often used to evaluate forecasts accross multiple time series because they are interpretable. Among them, the relative mean squared error ($\mathrm{MSE}$), known in positive orientation as the Nash-Sutcliffe efficiency ($\mathrm{NSE}$), is perhaps the most widely applied. We refer to the negatively oriented relative $\mathrm{MSE}$ as the Nash-Sutcliffe loss $L_\mathrm{NS} = 1 - \mathrm{NSE}$ and formulate a statistical decision-theoretic characterization of this loss. Under almost surely nonconstant observations and finite weighted-moment conditions, $L_\mathrm{NS}$ is strictly consistent for a multi-dimensional realization-weighted component-wise expectation, referred to as the Nash-Sutcliffe functional. Because the weight depends inversely on within-series spread, this functional generally differs from the component-wise expectation elicited by multi-dimensional squared error loss. As time series length (dimension) increases, we show under weighted inverse-spread concentration that $L_\mathrm{NS}$ converges in expectation to a constant multiple of average squared error on forecasts of bounded average squared norm, while coordinate-covariance or mean-norm conditions make fixed-coordinate differences or the average squared difference vanish, respectively. Supporting results include the construction of a strict identification function for the Nash-Sutcliffe functional, strongly consistent location \emph{M}-estimation under $L_\mathrm{NS}$, equality conditions (including central symmetry about a constant vector), and truncated distribution families satisfying the domain and moment assumptions of $L_\mathrm{NS}$.

stat.ML↗

Beyond Augmented-Action Surrogates for Multi-Expert Learning-to-Defer

A learning-to-defer (L2D) system decides, for each input, whether to predict on its own or defer to one of several experts. A widely used recipe trains the classifier and the router jointly by treating the $K$ classes and $J$ experts as competing actions in one shared $(K{+}J)$-action geometry. We analyze the population targets and optimization geometry of five representative surrogates and identify target distortion, gradient amplification, winner-take-all starvation, set-mass collapse, and class--expert coupling, which can persist alongside statistical consistency; shared competition and local overlap amplification also persist beyond log-softmax. We depart from the augmented-action formulation with a \emph{decoupled surrogate}, which pairs a softmax classifier head with an independent sigmoid head for each expert. Its population minimizer recovers the class posterior and expert utilities exactly, its coordinatewise expert updates avoid overlap amplification and starvation, and its mixed head Hessian block is zero even with a shared representation. We prove an excess-risk bound with calibration constant $\max\{\sqrt{2},\sqrt{2J/λ}\}$, which does not depend on the number of experts at fixed per-expert weight. In synthetic studies the decoupled surrogate preserves rare specialists, on CIFAR-10, CIFAR-10H, Covertype, and Fashion-MNIST it preserves classifier quality, and Fashion-MNIST ablations favor it over additive cross-entropy in all $36$ matched comparisons across head layouts and trunk choices. With disjoint networks, the same objective also supports two-stage training.

stat.ML↗