Learn R Programming

⚠️There's a newer version (0.2.0) of this package.Take me there.

NeuralEstimators

This repository contains the R interface to the Julia package NeuralEstimators (see here). The package facilitates the user-friendly development of neural point estimators, which are neural networks that map data to a point summary of the posterior distribution. These estimators are likelihood-free and amortised, in the sense that, after an initial setup cost, inference from observed data can be made in a fraction of the time required by conventional approaches. It also facilitates the construction of neural networks that approximate the likelihood-to-evidence ratio in an amortised fashion, which allows for making inference based on the likelihood function or the entire posterior distribution. The package caters for any model for which simulation is feasible by allowing the user to implicitly define their model via simulated data. See the vignette to get started!

Installation

To install the package, please:

  1. Install Julia (see here) and R (see here).
  2. Install the Julia version of NeuralEstimators.
    • To install the current stable version of the package from terminal, run the command julia -e 'using Pkg; Pkg.add("NeuralEstimators")'.
    • Alternatively, one may install the development version using julia -e 'using Pkg; Pkg.add(url="https://github.com/msainsburydale/NeuralEstimators.jl")'.
  3. Install the R interface to NeuralEstimators.
    • The package is available on CRAN, so one may simply run install.packages("NeuralEstimators") within R.
    • Alternatively, one may install the development version by installing devtools and running devtools::install_github("msainsburydale/NeuralEstimators").

Note that if you wish to simulate training data "on-the-fly" using R functions, you will also need to install the Julia package RCall. Note also that one may compile the vignettes during installation (which takes roughly 10 minutes) by adding the argument build_vignettes = TRUE in the final command above.

Supporting and citing

This software was developed as part of academic research. If you would like to support it, please star the repository. If you use it in your research or other activities, please also use the following citation.

@article{,
	author = {Sainsbury-Dale, Matthew and Zammit-Mangion, Andrew and Huser, Raphaël},
	title = {Likelihood-Free Parameter Estimation with Neural {B}ayes Estimators},
	journal = {The American Statistician},
	year = {2024},
	volume = {78},
	pages = {1--14},
	doi = {10.1080/00031305.2023.2249522},
	url = {https://doi.org/10.1080/00031305.2023.2249522}
}

Papers using NeuralEstimators

  • Likelihood-free parameter estimation with neural Bayes estimators [paper] [code]

  • Neural Bayes estimators for censored inference with peaks-over-threshold models [paper]

  • Neural Bayes estimators for irregular spatial data using graph neural networks [paper][code]

  • Modern extreme value statistics for Utopian extremes [paper]

  • Neural Methods for Amortised Inference [paper][code]

Related packages

Several other software packages have been developed to facilitate neural likelihood-free inference. These include:

A summary of the functionality in these packages is given in Zammit-Mangion et al. (2024, Section 6.1). Note that this list of related packages was created in July 2024; if you have software to add to this list, please contact the package maintainer.

Copy Link

Version

Install

install.packages('NeuralEstimators')

Monthly Downloads

186

Version

0.1.2

License

GPL (>= 2)

Maintainer

Matthew Sainsbury-Dale

Last Published

December 19th, 2024

Functions in NeuralEstimators (0.1.2)

plotdistribution

Plot the empirical sampling distribution of an estimator.
bias

computes a Monte Carlo approximation of an estimator's bias
bootstrap

bootstrap
NeuralEstimators-package

NeuralEstimators: Likelihood-Free Parameter Estimation using Neural Networks
loadstate

load a saved state of a neural estimator
initialise_estimator

Initialise a neural estimator
estimate

estimate
assess

assess a neural estimator
mapestimate

Maximum a posteriori estimation
loadweights

load a collection of saved weights of a neural estimator
encodedata

encodedata
train

Train a neural estimator
rmse

computes a Monte Carlo approximation of an estimator's root-mean-square error (RMSE)
sampleposterior

sampleposterior
plotestimates

Plot estimates vs. true values.
mlestimate

Maximum likelihood estimation
savestate

save the state of a neural estimator
risk

computes a Monte Carlo approximation of an estimator's Bayes risk
tanhloss

tanhloss