HNPE: Leveraging Global Parameters for Neural Posterior Estimation

1 Introduction . Simulation-based inference ( SBI ) has the potential to revolutionize experimental science as it opens the door to the inversion of arbitrary complex non-linear computer models , such as those found in physics , biology , or neuroscience ( Cranmer et al. , 2020 ) . The only requirement is to have access to a mathematical model implemented as a simulator . When applied to biophysical models and simulators in neuroscience ( e.g . Leon et al . 2013 ) , it could estimate properties of the brain closer to the cellular level , thus closing the gap between the neuroimaging and computational neuroscience communities . Grounded in Bayesian statistics , recent SBI techniques profit from recent advances in deep generative modeling to approximate the posterior distributions over the full simulator parameters . Their intrinsic quantification of uncertainties reveals whether certain parameters are worth ( or not ) scientific interpretation given some experimental observation . SBI is concerned with the estimation of a conditional distribution over parameters of interest ✓ . Given some observation x0 , the goal is to compute the posterior p ( ✓|x0 ) . It generally happens that some of these parameters are strongly coupled , leading to very structured posteriors with low dimensional sets of equally likely parameters values . For example , this happens when the data generative process depends only on the products of some parameters : multiplying one of such parameters by a constant and another by its inverse will not affect the output . Performing Bayesian inference on such models naturally leads to a “ ridge ” or “ banana shape ” in the posterior landscape , as seen e.g . in Figure 4 of Gonçalves et al . ( 2020 ) . More formally the present challenge is posed as soon as the model likelihood 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . function is non-injective w.r.t . ✓ , and is not strictly due to the presence of noise on the output observations . In statistics and econometrics literature , such models are called partially identified models ( Gustafson , 2014 ) . To alleviate the ill-posedness of the estimation problem , one may consider a hierarchical Bayesian model ( Gelman and Hill , 2007 ) where certain parameters are shared among different observations . In other words , the model ’ s parameters ✓i for an observation xi are partitioned into ✓i = { ↵i , } , where ↵i is a set of sample specific ( or local ) parameters , and corresponds to shared ( or global ) parameters . For this broad class of hierarchical models , the posterior distribution for a set X = { x1 , . . . , xN } of N observations can be written as ( Tran et al. , 2017 ) : p ( ↵1 , . . . , ↵N , |X ) / p ( ) NY i=1 p ( xi|↵i , ) p ( ↵i| ) . ( 1 ) Hierarchical models share statistical strength across observations , hence resulting in sharper posteriors and more reliable estimates of the ( global and local ) parameters and their uncertainty . Examples of applications of hierarchical models are topic models ( Blei et al. , 2003 ) , matrix factorization algorithms ( Salakhutdinov et al. , 2013 ) , including Bayesian non-parametrics strategies ( Teh and Jordan , 2010 ) , and population genetics ( Bazin et al. , 2010 ) . In this work , we further assume that the likelihood function p ( xi|↵i , ) is implicit and intractable , which implies that traditional MCMC methods can not be used to estimate the posterior distribution . This setup leads to so-called likelihood-free inference ( LFI ) problems and many algorithms ( Papamakarios and Murray , 2016 ; Greenberg et al. , 2019 ; Hermans et al. , 2020 ; Durkan et al. , 2020b ) have recently been developed to carry out inference under this scenario . These methods all operate by learning parts of the Bayes ’ rule , such as the likelihood function , the likelihood-to-evidence ratio , or the posterior itself . Approaches for LFI in hierarchical models exist , but are limited . Bazin et al . ( 2010 ) extend approximate Bayesian computation ( ABC ) into a two-step procedure in which local and global variables are estimated . Tran et al . ( 2017 ) adapt variational inference to hierarchical implicit models using a GAN-like training approach , while Brehmer et al . ( 2019 ) and Hermans et al . ( 2020 ) extend amortized likelihood ratios to deal with global parameters , but can not do inference on local parameters . Motivated by the posterior estimates of individual samples , we consider a sequential neural posterior estimation approach derived from SNPE-C ( Greenberg et al. , 2019 ) . The paper is organized as follows . First , we formalize our estimation problem by introducing the notion of global and local parameters , and instantiate it on a motivating example amenable to analytic posterior estimates allowing for quantitative evaluation . Then , we propose a neural posterior estimation technique based on a pair of normalizing flows and a deepset architecture ( Zaheer et al. , 2017 ) for conditioning on the set X of observations sharing the global parameters ; we call our method ‘ hierarchical neural posterior estimation ’ , or simply HNPE . Results on an application with time series produced by a non-linear model from computational neuroscience ( Ableidinger et al. , 2017 ) demonstrate the gain in statistical power of our approach thanks to the use of auxiliary observations . We also use this model to analyse real brain signals , giving a full demonstration of the power of LFI to relate parameters from theoretical models to real experimental recordings . 2 Hierarchical models with global parameters . Motivating example . Consider a stochastic model with two parameters , ↵ and , that generates as output x = ↵ + `` , where `` ⇠ N ( 0 , 2 ) . We assume that both parameters have uniform prior distribution ↵ , ⇠ U [ 0 , 1 ] and that is known and small . Our goal is to obtain the posterior distribution of ( ↵ , ) for a given observation x0 = ↵0 0+ '' . This simple example describes common situations where indeterminacy emerges . For instance , x0 could be the radiation power measured by a sensor , ↵ the intensity of the emitting source , and the inverse squared distance of the sensor to the source . In this case , a given measurement may have been due to either close weak sources ( ↵ # and `` ) or far strong ones ( ↵ `` and # ) . Using Bayes ’ rule and considering small we can write ( see Appendix A for more details ) p ( ↵ , |x0 ) ⇡ e ( x0 ↵ ) 2/2 2 p 2⇡ 2 1 [ 0,1 ] ( ↵ ) 1 [ 0,1 ] ( ) log ( 1/x0 ) , ( 2 ) where 1 [ a , b ] ( x ) is an indicator function that equals one for x 2 [ a , b ] and zero elsewhere . Note that the first term in the product converges to ( x0 ↵ ) as ! 0 and that the joint posterior distribution has an infinite number of pairs ( ↵ , ) with the same probability , revealing the parameter indeterminacy of this example . Indeed , for x 2 [ 0 , 1 ] and 2 [ x , 1 ] , all pairs of parameters ( x , ) yield the same observations and the likelihood function p ( ·| x , ) is constant . Thus , the posterior distribution has level sets with a ridge or “ banana shape ” along these solutions . The top row of Figure 1 on Page 4 portrays the joint and the marginal posterior distributions when ( ↵0 , 0 ) = ( 0.5 , 0.5 ) and = 0 . Exploiting the additional information in X . Our motivating example illustrates a situation where two parameters are related in such a way that one may not be known without the other . In practice , however , it is possible that one of these parameters is shared with other observations . For instance , this is the case when a single source of radiation is measured with multiple sensors located at different unknown distances . The power of the source is fixed across multiple measurements and its posterior can be better inferred by aggregating the information from all sensors . Our goal in this section is to formalize such setting so as to leverage this additional information and obtain a posterior distribution that ‘ breaks ’ parameter indeterminacy . Note that the root cause of the statistical challenge here is not the presence of noise , but rather the intrinsic structure of the observation model . To tackle the inverse problem of determining the posterior distribution of parameters ( ↵0 , ) given an observation x0 of a stochastic model , we consider the following scenario . We assume that the model ’ s structure is such that ↵0 is a parameter specific to each observation ( local ) , while is shared among different observations ( global ) . Yet , both are unknown . We consider having access to a set X = { x1 , . . . , xN } of additional observations generated with the same as x0 . Taking the model ’ s hierarchical structure into account we use Bayes ’ rule to write p ( ↵0 , |x0 , X ) = p ( ↵0| , x0 , X ) p ( |x0 , X ) / p ( ↵0| , x0 ) p ( x0 , X| ) p ( ) / p ( ↵0| , x0 ) p ( ) QN i=0 p ( xi| ) / p ( ↵0 , |x0 ) p ( ) N QN i=1 p ( |xi ) ( 3 ) which shows how the initial posterior distribution p ( ↵0 , |x0 ) is modified by additional observations from X sharing the same as x0 . In Section 3 , we present a strategy for approximating such posterior distribution when the likelihood function of the stochastic model of interest is intractable and , therefore , the posterior distributions p ( ↵0| , x0 ) and p ( |x0 , X ) have to be approximated with conditional density estimators . Motivating example with multiple observations . We now detail the effect of X on the posterior distribution of our motivating example . The N + 1 observations in { x0 } [ X are such that xi = ↵i 0 + `` for i = 0 , . . . , N with ↵i ⇠ U [ 0 , 1 ] drawn from the same prior . The posterior distribution may be written as ( see Appendix A ) p ( ↵0 , |x0 , X ) ⇡ p ( ↵0 , |x0 ) 1 [ µ,1 ] ( ) N N log ( 1/x0 ) ( 1/µN 1 ) , ( 4 ) where µ = max ( { x0 } [ X ) . This expression shows how the initial full posterior distribution ( 2 ) changes with the extra information conveyed by X . It can be also shown that as N ! 0 ( no additional observations ) the posterior distribution converges back to p ( ↵0 , |x0 ) . Figure 1 portrays the joint and marginal posterior distributions with N = 10 and N = 100 .

Summary: This paper proposes an approach to perform statistical inference for hierarchical models with intractable likelihoods. It extends an existing approach for simulation-based inference (SNPE-C) in order to use models that have global and local random variables.   The authors propose a scheme in which two conditional flows a trained: The first flow models a distribution over global parameters given an observation and $N$ permutation invariant auxiliary observations. Permutation invariance could e.g. be accounted for with a deepset architecture. The experiments do not make use of this flexibility, relying on an average operation instead. The second flow then models a distribution over local parameters given the observation and global parameters. They refer to the resulting inference scheme jointly as h-Flow, for hierarchical flow.  A motivating toy example is provided, along with a relevant, more realistic simulator from Neuroscience (a Neural Mass Model; NMM). h-Flow is compared against a naive approach on both of these examples. The comparison turns out about equal on the toy example and favorably for h-Flow on the NMM. On the toy example, h-Flow is additionally compared against a hierarchical ABC variant and LFVI, comparing favorably to both of them.