Package: lf2i
LF2I: Likelihood-Free Frequentist InferenceLF2I: Likelihood-Free Frequentist InferenceGetting StartedWhat is LFI?What does LF2I do?Structure of LF2IUsageInstallFeedback and ContributionsReferencesGetting StartedWhat is LFI?lf2iis a Python package for likelihood-free inference; that is, inference on the parameters $\boldsymbol{\theta}$ of a statistical model $F_{\boldsymbol{\theta}}$ in a setting where the likelihood $\mathcal{L}(\boldsymbol{\theta}; \mathcal{D}):=p(\mathcal{D}|\boldsymbol{\theta})$ cannot be evaluated but isimplicitlyencoded by a high-fidelity simulator for $F_{\boldsymbol{\theta}}$. In other words, one can simulate data in batches of size $n$, $\mathcal{D}=(X_1, \dots, X_n)$, for any given $\boldsymbol{\theta}$ in the parameter space.What does LF2I do?lf2iconstructs confidence regions for internal parameters with correctcoverageacross the whole parameter space, that is, sets $\mathcal{R}(\mathcal{D})$ satisfying $\mathbb{P}({\boldsymbol{\theta}} \in \mathcal{R}(\mathcal{D})) = 1 - \alpha\text{ } \text{ }\forall\theta\in\Theta$, where $(1 − \alpha) \in (0, 1)$ is a prespecified confidence level.Coverage is guaranteed regardless ofthe prior distribution over the parameters of interest;the true value of the parameters of interest: the coverage guarantee holds point-wise over the parameter space (i.e., not only on average); andthe size of the observed sample: the coverage guarantee holds even for finite sample sizes, including for the case of one observation, i.e. $n=1$.Structure of LF2Ilf2iis based on the equivalence of confidence sets and hypothesis tests. It leverages supervised machine learning methods to efficiently execute the Neyman construction of confidence sets. The framework has three separate modules for estimatingtest statistics (such asACORE,BFF,Waldo, etc...);critical values for a level $\alpha$ test; andempirical coverageacross the entire parameter space. See the figure below for a schematic diagram.While1.and2.are used to construct the confidence sets,3.is an independent diagnostic tool that can be used to check whether a given parameter region (such as,lf2iconfidence sets, posterior credible regions, prediction sets, etc …) has the right conditional coverage. Becauself2iis modular, users can construct valid confidence sets using any test statistic of their choice.Usagelf2ioffers a simple interface that allows you to get started quickly. The entry point is theLF2Iclass in thelf2i.inferencemodule, which contains classes to wrap the different functionalities. The methodinferencemerges steps1.and2.to return confidence sets with correct coverage. The methoddiagnosticsperforms step3.as an independent check of empirical coverage of the constructed parameter regions.Check thewebsitefor the full documentation, complete of tutorials on theWaldotest statistics. Tutorials on likelihood-based test statistics like ACORE and BFF are coming soon!InstallThe package is under active development, and is available on PyPI at thislink. It can be installed usingpip:pipinstalllf2iThe diagnostics module leverages smoothing splines implemented inR, which is assumed to be installed along with themgcvpackage.Feedback and ContributionsWe strongly encourage users to leave feedback and report bugs either by using theIssuestab, or by contacting us directly. The current maintainer can be reachedhere.If you want to contribute, feel free to open an issue and/or a pull request.ReferencesLF2I is based on the following research articles:-Confidence sets and hypothesis testing in a likelihood-free inference setting (ICML 2020)-Likelihood-Free Frequentist Inference: Bridging Classical Statistics and Machine Learning for Reliable Simulator-Based Inference (2021)-Simulation-Based Inference with Waldo: Confidence Regions by Leveraging Prediction Algorithms and Posterior Estimators for Inverse Problems (AISTATS 2023)