alphaFeedback

WorksMathematics

Model Criticism via Stochastic Optimization

AI contributions
Not recorded for this paper
View details

Abstract

Many generative models are specified by how data are simulated. An observation is a deterministic transform Y=G(θ,X)Y=G(θ,X) of a draw XX from an assumed noise law, indexed by a structural parameter θθ. Such models cover discrete, continuous and functional data, as well as i.i.d. replicates of stochastic processes, but their likelihoods are often unavailable. We propose a simulation-based procedure that tests whether such a model fits the data and, when it does not, locates where it fails, without choosing a test statistic. The procedure splits the data in two and is formulated as a two-stage stochastic program. In the estimation stage, θθ is fitted on the first block by minimizing a Wasserstein distance between the data and simulations from the model. In the recourse stage, θθ is frozen at the fitted θ~\tildeθ, and a finite set of representative noise values {xˉj}\{\bar x_j\} is pushed through the fitted mechanism to give model atoms G(θ~,xˉj)G(\tildeθ,\bar x_j). The held-out block optimizes weights w\textbf{w} on the model atoms to best match its own distribution. The optimized weights are then compared with theoretical weights under correct specification. Since each model atom is the image of known noise values, the disagreement between optimal and theoretical weights points to the part of the noise law that is wrong. The split makes the scaled weights conditionally multinomial, yielding a calibrated Pearson test. We prove strong consistency of both stages under checkable assumptions and illustrate the procedure on a Gaussian location–scale family, the number of segregating sites under Kingman's coalescent, a Yule process, and an Ornstein–Uhlenbeck diffusion.

Introduction

A generative model specifies a mechanism: an observation is a deterministic transform, indexed by a structural parameter θ\theta, of a draw from an assumed noise law, Y=G(θ,X)Y = G(\theta, X) with X∼νX \sim\nu. The noise XX may live in any Polish space, such as a Euclidean space or a space of functions, and so may the observation YY. The class therefore covers discrete and continuous observations, as well as i.i.d. replicates of stochastic processes whose simulation algorithm is a deterministic map of its driving randomness. For instance, continuous-time Markov chains are driven by Poisson random measures, and diffusions by Brownian motion. Model criticism asks whether such a model is adequate for the data at hand and, when it is not, where it fails. For many generative models the likelihood is unavailable or intractable, while simulation from GG is easy. We propose a criticism procedure that uses only simulation and a distance between distributions, without the need to choose a test statistic. It is formulated as a two-stage stochastic program in the sense of [33 Eq. (1.9].

The procedure splits the observations into an estimation block ξ0\xi_0 and a held-out block ξ1\xi_1, and uses them in two stages.

Estimation stage. Using ξ0\xi_0, we fit the structural parameter θ\theta while keeping the noise law exactly as the modeler wrote it down. The estimate θ~\tilde{\theta} minimizes the 1-Wasserstein distance between the data and simulations from the model [5] (Bassetti et al. 2006), computed by sample average approximation [36]. Minimum-distance estimators of this kind are robust [11] (Bassetti and Regazzini 2006), so a mild misfit of the noise law does not drag θ~\tilde{\theta} far from the truth.

Recourse stage. With θ\theta frozen at θ~\tilde{\theta}, we ask how the held-out data distribute themselves relative to the fitted model. To make this question tractable, we choose a small set of representative noise values xˉ1,…,xˉN1\bar{x}_1,\ldots,\bar{x}_{N_1} (the mesh), and push each through the fitted mechanism G(θ~,⋅)G(\tilde{\theta},\cdot). The resulting points zℓ=G(θ~,xˉj)z_{\ell}=G(\tilde{\theta},\bar{x}_j) are the atoms of the fitted model, interpreted as typical observations the fitted model can produce, one for each representative noise value (noise values that produce the same observation are merged into one atom). Each atom owns a cell, the set of observations closer to it than to any other atom. The fitted model assigns a probability to every cell and the held-out block gives an empirical frequency for every cell. The recourse decision is the vector w\mathbf{w} of weights on the atoms, and the optimal w\mathbf{w} turns out to be exactly these held-out cell frequencies, in closed form. Under a correct model the two sets of numbers agree; where they disagree, the model fails. Because each atom is the image of known noise values, a cell with too much or too little held-out mass points to the part of the noise distribution that is wrong. The cell counts also give a Pearson test of the model, conditional on θ~\tilde{\theta}.

The split is what makes this test calibrated, and splitting is familiar in Bayesian model criticism. In Moran et al. [29] and Li and Huggins [27] the split repairs a calibration defect as the posterior predictive pp-value is usually not uniform under the null [17], and holding out a block restores uniformity. There the two halves play the roles of “train” and “test” for one and the same object, the predictive distribution. Our two halves instead determine two different decisions. ξ0\xi_0 determines θ\theta with the noise law held at ν\nu, and ξ1\xi_1 determines w\mathbf{w} with θ\theta held at θ~\tilde{\theta}. Because θ~\tilde{\theta} is computed from ξ0\xi_0 alone, the held-out counts are, given θ~\tilde{\theta}, multinomial with known cell probabilities under the null, so the test is calibrated without any correction for estimation. Robustness of the first stage matters here as it guards θ~\tilde{\theta} against mild misspecification of the structure GG or of the noise law ν\nu, so that the misfit is left for the recourse stage to expose rather than absorbed into the fit.

The program of criticizing a model by confronting it with data it was not fitted to descends from Box [8], who separated estimation within a model from criticism of the model itself, and from the posterior predictive assessment of Gelman et al. [18]. The resulting pp-values are not uniform under the null when the same data both fit and score the model [4], and it motivates the split constructions of Moran et al. [29] and Li and Huggins [27] discussed above. Our structural stance is closest to Covington and Miller [10], who also criticize a model through a parametrization of its noise rather than through a statistic of the observations.

The paper is organized as follows. § 2 recalls the Wasserstein distance and two-stage stochastic programs, and casts model criticism as a two-stage program (§ 2.3). § 3 constructs the ingredients: the structural model, including stochastic processes, the split, the synthetic noise of the estimation stage, and the recourse mesh. § 4 develops the two stages, the prior test, the diagnostic and the calibrated test. § 5 states the assumptions under which both stages are consistent. § 6 illustrates the procedure on four models. § 7 describes the algorithms, and § 8 discusses limitations and extensions. Proofs, and the verification of the assumptions for the examples are in the appendix.

Preliminaries

The space of measures and the Wasserstein distance

Throughout, the sample space SS is a Polish space, a separable metric space whose metric dd is complete. The leading cases are the Euclidean space S=RdS = \mathbb{R}^{d}, which contains integer-valued records such as counts at finitely many times, and path spaces such as L1([0,T];Rd)L^{1}([0,T];\mathbb{R}^{d}), L2([0,T];Rd)L^{2}([0,T];\mathbb{R}^{d}) and C([0,T];Rd)C([0,T];\mathbb{R}^{d}) with the supremum norm; when SS is a normed space, d(ω1,ω2)=∥ω1−ω2∥d(\omega_{1},\omega_{2}) = \lVert\omega_{1}-\omega_{2}\rVert. Let P(S)\mathcal{P}(S) denote the probability measures on SS, and

P1(S):={μ∈P(S):∫Sd(ω0,ω) μ(dω)<∞ for some (all) ω0∈S}.\mathcal{P}_{1}(S) := \left\{ \mu\in\mathcal{P}(S) : \int_{S} d(\omega_{0},\omega) \,\mu(\mathrm{d}\omega) < \infty\text{ for some (all) } \omega_{0} \in S \right\}.

For μ,ν∈P1(S)\mu,\nu\in\mathcal{P}_{1}(S) the Wasserstein-1 distance is

W1(μ,ν):=inf⁡π∈Π(μ,ν)∫S×Sd(ω1,ω2) π(dω1,dω2),(1)W_{1}(\mu,\nu) := \inf_{\pi\in\Pi(\mu,\nu)} \int_{S \times S} d(\omega_{1},\omega_{2}) \,\pi(\mathrm{d}\omega_{1},\mathrm{d}\omega_{2}), \tag*{(1)}

the infimum being over the set of couplings Π\Pi with marginals μ\mu and ν\nu. By Kantorovich–Rubinstein duality [33, 41 Ch. 2],

W1(μ,ν)=sup⁡{∫Sf d(μ−ν):∥f∥Lip≤1}.(2)W_{1}(\mu,\nu) = \sup\left\{ \int_{S} f \,\mathrm{d}(\mu-\nu) : \lVert f\rVert_{\mathrm{Lip}} \le1 \right\}. \tag*{(2)}

The metric space (P1(S),W1)(\mathcal{P}_{1}(S), W_{1}) is complete and separable. Explicitly, if CC is a countable dense subset of SS, then the set of molecular probability measures with rational coefficients on CC,

{∑i=1nqiδci∣ci∈C, 0≤qi∈Q, ∑i=1nqi=1, n∈N},(3)\left\{ \sum_{i=1}^{n} q_{i}\delta_{c_{i}} \mid c_{i} \in C,\ 0 \le q_{i} \in\mathbb{Q},\ \sum_{i=1}^{n} q_{i} = 1,\ n \in\mathbb{N} \right\}, \tag*{(3)}

is a countable dense subset of (P1(S),W1)(\mathcal{P}_{1}(S), W_{1}); see Dudley [12] and Düll et al. [13] for more details. In contrast, P1(S)\mathcal{P}_{1}(S) equipped with ∥⋅∥TV\lVert\cdot\rVert_{\mathrm{TV}} is not separable as shown in Example 1. In addition, W1W_{1} metrizes weak convergence together with convergence of first moments on P1(S)\mathcal{P}_{1}(S) Villani, [41].

Example 1. For a≠ba \ne b, ∥δa−δb∥TV=1\lVert\delta_{a}-\delta_{b}\rVert_{\mathrm{TV}} = 1, so an→ba_{n} \to b in SS does not imply ∥δan−δb∥TV→0\lVert\delta_{a_{n}}-\delta_{b}\rVert_{\mathrm{TV}} \to0. By contrast W1(δan,δb)=d(an,b)W_{1}(\delta_{a_{n}},\delta_{b}) = d(a_{n},b) and an→ba_{n} \to b implies W1(δan,δb)→0W_{1}(\delta_{a_{n}},\delta_{b}) \to0.

Two-stage stochastic programs

A stochastic optimization problem selects a decision to optimize a cost that depends on uncertainty whose distribution is known. In the canonical form of Pflug and Pichler [33],

min⁡x∈XRP[Q(x,ξ)],(4)\min_{x \in\mathbb{X}} R_{P}[Q(x,\xi)], \tag*{(4)}

ξ∼P\xi\sim P is the random datum, x∈Xx \in\mathbb{X} the decision, Q(x,ξ)Q(x,\xi) the resulting cost, and RPR_{P} a risk functional summarizing the random cost by a scalar. Taking RP=EPR_{P} = \mathbb{E}_{P} gives a risk-neutral program. When PP is not tractable, the sample average approximation (SAA) replaces it by the empirical measure of scenarios drawn once and for all from PP and solves the resulting deterministic program Shapiro et al., [36].

Decisions are random variables constrained to use only the information available when they are taken. A filtration F0⊆F1⊆⋯\mathcal{F}_{0} \subseteq\mathcal{F}_{1} \subseteq\cdots encodes that flow, and a decision fixed at stage tt must be Ft\mathcal{F}_{t}-measurable. The two extremes are a here-and-now decision, fixed before the relevant uncertainty is observed, and a wait-and-see decision, taken after the realization and so free to depend on it. A two-stage recourse program fixes x0x_{0} here-and-now, observes ξ1\xi_{1}, and then takes a recourse (corrective) action in the feasible set x1∈X1(x0,ξ1)x_{1} \in\mathbb{X}_{1}(x_{0},\xi_{1}). § 2.3 casts model criticism in this form.

Model criticism as a two-stage program

We ask two questions in sequence. First, which structure within the model class describes the data best, when the noise law is taken exactly as the modeler wrote it down? Second, with that structure fixed, how do new data redistribute the mass that the fitted model assigns to its own support? We answer the two questions by the two stages of a stochastic program on a sample split (ξ0,ξ1)(\xi_0,\xi_1), with the following correspondence:

Stage 0 (here-and-now)Stage 1 (recourse)
DecisionStructural parameter θ∈K⊆Θ\theta\in K \subseteq\ThetaWeights w∈ΔL−1\mathbf{w} \in\Delta^{L-1} on the atoms of Pθ~P_{\tilde{\theta}}
InformationEstimation block ξ0\xi_0 and synthetic noiseHeld-out block ξ1\xi_1, with θ~\tilde{\theta} fixed
CostW1(P^ξ0,Pθ)W_1(\widehat{P}_{\xi_0},P_\theta)W1(P^ξ1,Pθ~,w)W_1(\widehat{P}_{\xi_1},P_{\tilde{\theta},\mathbf{w}})
InterpretationBest structure under the assumed noise lawHow the held-out data reweight the fitted model

Table 1.

Written out, the program is

θ~∈arg⁡min⁡θ∈K  W1(P^ξ0,Pθ),w~∈arg⁡min⁡w∈ΔL(θ~)−1  W1(P^ξ1,∑ℓwℓδzℓ(θ~)),(5)\begin{aligned} \tilde{\theta} &\in\underset{\theta\in K}{\arg\min}\; W_1\left(\widehat{P}_{\xi_0},P_\theta\right), \qquad \tilde{\mathbf{w}} \in\underset{\mathbf{w}\in\Delta^{L(\tilde{\theta})-1}}{\arg\min}\; W_1\left(\widehat{P}_{\xi_1},\sum_{\ell}w_\ell\delta_{z_\ell(\tilde{\theta})}\right), \tag*{(5)} \end{aligned}

References

  1. [1]D. F. Anderson and T. G. Kurtz. Stochastic Analysis of Biochemical Systems, volume 1.2 of Mathematical Biosciences Institute Lecture Series. Springer, Cham, 2015.DOI
  2. [4]M. J. Bayarri and J. O. Berger. P values for composite null models. Journal of the American Statistical Association, 95(452):1127–1142, 2000.
  3. [5]E. Bernton, P. E. Jacob, M. Gerber, and C. P. Robert. On parameter estimation with the Wasserstein distance. Information and Inference: A Journal of the IMA, 8(4):657–676, 2019.arxiv.org/abs/1701.05146
  4. [6]P. Billingsley. Convergence of Probability Measures. Wiley, New York, second edition, 1999.
  5. [7]P. Borman and D. Elder. Q2(R1) validation of analytical procedures: text and methodology. In A. Teasdale, D. Elder, and R. W. Nims, editors, ICH Quality Guidelines: An Implementation Guide, pages 127–166. John Wiley & Sons, Hoboken, NJ, 2017.
  6. [8]G. E. P. Box. Sampling and Bayes’ inference in scientific modelling and robustness. Journal of the Royal Statistical Society: Series A (General), 143(4):383–430, 1980.
  7. [9]W. G. Cochran. Some methods for strengthening the common χ² tests. Biometries, 10(4):417–451, 1954.DOI
  8. [10]C. T. Covington and J. W. Miller. Bayesian model criticism using uniform parametrization checks. arXiv preprint arXiv:2503.18261, 2025.arxiv.org/abs/2503.18261
  9. [11]D. L. Donoho and R. C. Liu. The “automatic” robustness of minimum distance functionals. The Annals of Statistics, 16(2):552–586, 1988.DOI
  10. [12]R. M. Dudley. Real Analysis and Probability. Chapman and Hall/CRC, New York, 2018.
  11. [13]C. Düll, P. Gwiazda, A. Marciniak-Czochra, and J. Skrzeczkowski. Spaces of Measures and their Applications to Structured Population Models, volume 36 of Cambridge Monographs on Applied and Computational Mathematics. Cambridge University Press, Cambridge, 2021.DOI
  12. [14]R. Flamary, N. Courty, A. Gramfort, M. Z. Alaya, A. Bois­bunon, S. Chambon, L. Chapel, A. Coren­flos, K. Fatras, N. Fournier, L. Gauth­eron, N. T. H. Gayraud, H. Janati, A. Rakotomamonjy, I. Redko, A. Rolet, A. Schutz, V. Seguy, D. J. Sutherland, R. Tavenard, A. Tong, and T. Vayer. POT: Python Optimal Transport. Journal of Machine Learning Research, 22(78):1–8, 2021.
  13. [15]N. Fournier and A. Guillin. On the rate of convergence in Wasserstein distance of the empirical measure. Probability Theory and Related Fields, 162(3–4):707–738, 2015.arxiv.org/abs/1312.2128
  14. [16]N. Fournier and S. Méléard. A microscopic probabilistic description of a locally regulated population and macroscopic approximations. The Annals of Applied Probability, 14(4):1880–1919, 2004.
  15. [17]A. Gelman. Two simple examples for understanding posterior p-values whose distributions are far from uniform. Electronic Journal of Statistics, 7:2595–2602, 2013.DOI
  16. [18]A. Gelman, X.-L. Meng, and H. Stern. Posterior predictive assessment of model fitness via realized discrepancies. Statistica Sinica, 6(4):733–807, 1996.
  17. [19]D. T. Gillespie. Exact stochastic simulation of coupled chemical reactions. The Journal of Physical Chemistry, 81(25):2340–2361, 1977.DOI
  18. [20]S. Graf and H. Luschgy. Foundations of Quantization for Probability Distributions, volume 1730 of Lecture Notes in Mathematics. Springer, Berlin, 2000.DOI
  19. [21]F. R. Hampel. A general qualitative definition of robustness. The Annals of Mathematical Statistics, 42(6):1887–1896, 1971.DOI
  20. [22]W. Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 58(301):13–30, 1963.
  21. [23]P. J. Huber and E. M. Ronchetti. Robust Statistics. John Wiley & Sons, Hoboken, NJ, second edition, 2009.
  22. [24]N. Ikeda and S. Watanabe. Stochastic Differential Equations and Diffusion Processes. North-Holland, Amsterdam, second edition, 1989.
  23. [25]D. G. Kendall. On the generalized “birth-and-death” process. The Annals of Mathematical Statistics, 19(1):1–15, 1948.DOI
  24. [26]J. F. C. Kingman. The coalescent. Stochastic Processes and their Applications, 13(3):235–248, 1982.DOI
  25. [27]J. Li and J. H. Huggins. Calibrated model criticism using split predictive checks. Journal of the American Statistical Association, 2026. Just accepted.DOI
  26. [28]H. Luschgy and G. Pagès. Functional quantization of Gaussian processes. Journal of Functional Analysis, 196(2):486–531, 2002.DOI
  27. [29]G. E. Moran, D. M. Blei, and R. Ranganath. Holdout predictive checks for Bayesian model criticism. Journal of the Royal Statistical Society Series B: Statistical Methodology, 86:194–214, 2024.DOI
  28. [30]K. Nadjahi, A. Durmus, U. Şimşekli, and R. Badeau. Asymptotic guarantees for learning generative models with the sliced-Wasserstein distance. In Advances in Neural Information Processing Systems, volume 32, 2019.arxiv.org/abs/1906.04516
  29. [31]J. A. Nelder and R. Mead. A simplex method for function minimization. The Computer Journal, 7(4):308–313, 1965.DOI
  30. [32]G. Peyré and M. Cuturi. Computational optimal transport: with applications to data science. Foundations and Trends in Machine Learning, 11(5–6):355–607, 2019.
  31. [33]G. C. Pflug and A. Pichler. Multistage Stochastic Optimization. Springer Series in Operations Research and Financial Engineering. Springer, Cham, 2014.DOI
  32. [34]O. Ratmann, C. Andrieu, C. Wiuf, and S. Richardson. Model criticism based on likelihood-free inference, with an application to protein network evolution. Proceedings of the National Academy of Sciences, 106(26):10576–10581, 2009.DOI
  33. [35]H. Scheffé. A useful convergence theorem for probability distributions. The Annals of Mathematical Statistics, 18(3):434–438, 1947.DOI
  34. [36]A. Shapiro, D. Dentcheva, and A. Ruszczyński. Lectures on Stochastic Programming: Modeling and Theory. SIAM, Philadelphia, second edition, 2014.
  35. [37]M. Slatkin and R. R. Hudson. Pairwise comparisons of mitochondrial DNA sequences in stable and exponentially growing populations. Genetics, 129(2):555–562, 1991.pubmed.ncbi.nlm.nih.gov/1743491
  36. [39]G. E. Uhlenbeck and L. S. Ornstein. On the theory of the Brownian motion. Physical Review, 36(5):823–841, 1930.DOI
  37. [41]C. Villani. Optimal Transport: Old and New, volume 338 of Grundlehren der mathematischen Wissenschaften. Springer, Berlin, 2009.
  38. [42]G. A. Watterson. On the number of segregating sites in genetical models without recombination. Theoretical Population Biology, 7(2):256–276, 1975.pubmed.ncbi.nlm.nih.gov/1145509

Paper details

vlnc:W_dsctbx9c
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

CC BY 4.0

Original source

  • Mathematics

Not recorded for this paper · View statement →

Looking for related papers…
Contents