Autoregressive Quantile Flows for Predictive Uncertainty Estimation

1 INTRODUCTION . Reasoning about uncertainty via the language of probability is important in many application domains of machine learning , including medicine ( Saria , 2018 ) , robotics ( Chua et al. , 2018 ; Buckman et al. , 2018 ) , and operations research ( Van Roy et al. , 1997 ) . Especially important is the estimation of predictive uncertainties ( e.g. , confidence intervals around forecasts ) ; in applications such as clinical diagnosis ( Jiang et al. , 2012 ) or decision support systems ( Werling et al. , 2015 ) , estimating uncertainty can be as important as obtaining high accuracy ( Kuleshov and Liang , 2015 ) . Normalizing flows ( Rezende and Mohamed , 2016 ; Papamakarios et al. , 2019 ; Kingma et al. , 2016 ) are a popular framework for defining probabilistic models , and can be used for density estimation ( Papamakarios et al. , 2017 ) , out-of-distribution detection ( Nalisnick et al. , 2019 ) , content generation ( Kingma and Dhariwal , 2018 ) , and more . Flows feature tractable posterior inference and maximum likelihood estimation ; however , maximum likelihood estimation of flows requires carefully designing a family of bijective functions that are simultaneously expressive and whose Jacobian has a tractable determinant . In practice , this makes flows time-consuming to design and computationally expensive to train . This paper takes a step towards addressing this limitation of normalizing flows by proposing new objectives that contribute towards alleviating the computational cost of calculating determinants of Jacobians . Specifically , we argue for training flows using an objective that is different from classical maximum likelihood and is instead based on proper scoring rules ( Gneiting and Raftery , 2007 ) , a standard tool in the statistics literature for evaluating the quality of probabilistic forecasts . We show that this objective can be used to train normalizing flows and that it simplifies the computation of Jacobians in certain types of flows . We introduce autoregressive quantile flows ( AQFs ) , a framework that combines the above learning objective with a set of architectural choices inspired by classical autoregressive flows . Quantile flows possess characteristics that represent an improvement over existing flow models—including supporting neural architectures that simultaneously provide fast training and sampling— in addition to the usual benefits of flows ( exact posterior inference and density estimation ) . Interestingly , quantile flows can be interpreted as extensions of quantile functions to multiple dimensions . We use AQFs as the basis for quantile flow regression ( QFR ) , an approach to predictive uncertainty estimation in which a probabilistic model directly outputs a normalizing flow as the predictive distribution . The QFR approach enables neural networks to output highly expressive probabilistic predictions that make very little assumptions on the form of the predicted variable and that improve uncertainty estimates in probabilistic and Bayesian models . In the one-dimensional case , our approach yields quantile function regression and cumulative distribution function regression , two simple , general , and principled approaches for flexible probabilistic forecasting in regression . In addition , we demonstrate the benefits of AQFs on probabilistic modeling tasks that include density estimation and autoregressive generation . Across our sets of experiments , we observe improved performance , and we demonstrate properties of quantile flows that traditional flow models do not possess ( e.g. , sampling with flexible neural parameterizations ) . Contributions . In summary , this work ( 1 ) introduces new objectives for flow models that simplify the computation of determinants of Jacobians , which in turn greatly simplifies the implementation of flow models and extends the class of models that can be used to parameterize flows . We also ( 2 ) define autoregressive quantile flows based on this objective , and highlight new architectures supported by this framework . Finally , ( 3 ) we deploy AQFs as part of quantile flow regression , and show that this approach improves upon existing methods for predictive uncertainty estimation . 2 BACKGROUND . Notation . Our goal is to learn a probabilistic model p ( y ) ∈ ∆ ( Rd ) in the space ∆ ( Rd ) of distributions over a high-dimensional y ∈ Rd ; we use yj ∈ R to denote components of y . In some cases , we have access to features x ∈ X associated with y and we want to train a forecaster H : X → ∆ ( Rd ) that outputs a predictive probability over y conditioned on x . 2.1 NORMALIZING FLOWS AND AUTOREGRESSIVE GENERATIVE MODELS . A normalizing flow defines a distribution p ( y ) via an invertible mapping fθ : Rd → Rd with parameters θ ∈ Θ that describes a transformation between y and a random variable z ∈ Rd sampled from a simple prior z ∼ p ( z ) ( Rezende and Mohamed , 2016 ; Papamakarios et al. , 2019 ) . We may compute p ( y ) via the change of variables formula p ( y ) = ∣∣∣∂fθ ( z ) −1∂z ∣∣∣ p ( z ) , where ∣∣∣∂fθ ( z ) −1∂z ∣∣∣ denotes the determinant of the inverse Jacobian of fθ . In order to fit flow-based models using maximum likelihood , we typically choose fθ to be in a family for which the Jacobian is tractable . A common way to define flows with a tractable Jacobian is via autoregressive models of the form yj = τ ( zj ; hj ) hj = cj ( y < j ) , where τ ( zj ; hj ) is an invertible transformer , a strictly monotonic function of zj , and cj is the j-th conditioner , which outputs parameters hj for the transformer . As long as τ is invertible , such autoregressive models can be used to define flows ( Papamakarios et al. , 2019 ) . 2.2 EVALUATING FORECASTS WITH PROPER SCORING RULES . A common way to represent a probabilistic forecast in the statistics and forecasting literature is via a cumulative distribution function ( CDF ) F : Rd → [ 0 , 1 ] ; any probability distribution can be represented this way , including discrete distributions . Since F is monotonically increasing in each coordinate , when y is one dimensional , we may define its inverse Q : [ 0 , 1 ] → R called the quantile function ( QF ) , defined as Q ( α ) = inf { y′ ∈ R | F ( y′ ) ≥ α } . In the statistics literature , the quality of forecasts is often evaluated using proper scoring rules ( or proper scores ; Gneiting and Raftery ( 2007 ) ) . For example , when predictions take the form of CDFs , a popular scoring rule is the continuous ranked probability score ( CRPS ) , defined for two CDFs F and G as CRPS ( F , G ) = ∫ y ( F ( y ) −G ( y ) ) 2 dy . When we only have samples y1 , ... , ym from G , we can generalize this score as 1m ∑m i=1 ∫ y ( F ( y ) − I ( y − yi ) ) 2 dy . Alternatively , we can evaluate the α-th quantile Q ( α ) of a QF Q via the check score L : R × R → R+ defined as Lα ( y , f ) = α ( y − f ) if y ≥ f and ( 1 − α ) ( f − y ) otherwise . The check score also provides a consistent estimator for the conditional quantile of any distribution . 3 TAKING STEPS BEYOND MAXIMUM LIKELIHOOD LEARNING OF FLOWS . Maximum likelihood estimation of flows requires carefully designing a family of bijective functions that are simultaneously expressive and whose Jacobian has a tractable determinant . In practice , this makes flows time-consuming to design and computationally expensive to train . In this paper , we argue for training flows using objectives based on proper scoring rules ( Gneiting and Raftery , 2007 ) . 3.1 LEARNING SIMPLE FLOWS WITH PROPER SCORING RULES . We begin with the one dimensional setting , where a flow fθ : R→ R is a bijective mapping that can be interpreted as a QF . Alternatively , the reverse flow f−1θ can be interpreted as a CDF . We will use Qθ , Fθ to denote fθ and f−1θ , respectively ; our goal is to fit these models from data . In order to fit models of the cumulative distribution and the quantile function , we propose objectives based on proper scoring rules . We propose fitting models Fθ of the CDF using the CRPS : L ( 1 ) ( Fθ , yi ) : = CRPS ( Fθ , yi ) = ∫ ∞ −∞ ( Fθ ( y ) − I ( yi ≤ y ) ) 2 dy . ( 1 ) When dealing with a model Qθ of the QF , we propose an objective based on the expected check score L ( 2 ) ( Qθ , yi ) : = ∫ 1 0 Lα ( Qθ ( α ) , yi ) dα , ( 2 ) where Lα is a check score targeting quantile α . We refer to this objective as the quantile loss . This objective has been used previously to train value functions in reinforcement learning as well as conditional distributions in autoregressive models ( Dabney et al. , 2018a ; b ) . In this paper , we describe its application to modeling aleatoric predictive uncertainties . The parametric form of Qθ or Fθ can be any class of strictly monotonic ( hence invertible ) functions . Previous works have relied on affine or piecewise linear functions ( Wehenkel and Louppe , 2021 ) , sum-of-squares ( Jaini et al. , 2019 ) , monotonic neural networks ( Huang et al. , 2018 ; Cao et al. , 2019 ) , and other models . Any of these choices suits our framework ; we provide more details below . Equivalence Between the CRPS and Quantile Losses So far , we have described two methods for fitting a one-dimensional flow model . Their objectives are actually equivalent . Proposition 1 . For a CDF F : R→ [ 0 , 1 ] and y′ ∈ R , the CRPS and quantile losses are equivalent : L ( 1 ) ( F , y′ ) = a · L ( 2 ) ( F−1 , y′ ) + b a , b ∈ R , a > 0 ( 3 ) This fact appears to be part of statistics folk knowledge , and we have only ever seen it stated briefly in some works . We provide a complete proof in the appendix . See ( Laio and Tamea , 2007 ) for another argument . If the models Fθ , Qθ are analytically invertible ( e.g. , they are piecewise linear ) , we are free to choose fitting the CDF or its inverse . Other representations for F will not lead to analytically invertible models , which require choosing a training direction , as we discuss below . Practical Implementation . The quantile and the CRPS losses both involve a potentially intractable integral . We approximate the integrals using Monte-Carlo ; this allows us to obtain gradients using backpropagation . For the quantile loss , we sample α uniformly at random in [ 0 , 1 ] ; for the CRPS loss , we choose a reasonable range of y ( usually , centered around yi ) and sample uniformly in that range . This approach works well in practice and avoids the complexity of alternative methods such as quadrature ( Durkan et al. , 2019 ) .

Summary: This paper proposes a novel framework for training flow models named Autoregressive Quantile Flows (AQF). The proposed method utilizes a new objective by evaluating forecasts with proper scoring rules, including the continuous ranked probability score and the check score. The advantages of the proposed objective are 1) it could avoid the explicit calculation of the determinant of the Jacobian matrix and 2) it could also provide uncertainty estimation for predictions. Experiments on multiple tasks including regression, object detection, time series forecasting, and generation validate the effectiveness of this framework.