Normalizing Flows for Rare-Event Inference
License: GPL-3
Overview
rareflow provides a unified framework for rare-event inference by combining:
-
Sanov theory for empirical distributions
-
Girsanov change of measure for SDEs
-
Freidlin–Wentzell large deviations for small-noise diffusions
- Normalizing flows for flexible variational inference
The package includes:
- modular flow models (planar, radial, MAF, spline)
- variational optimization via ELBO
- wrappers for Girsanov tilting and FW quasi-potentials
- tools for rare-event simulation and analysis
Installation
From GitHub
# install.packages("devtools")
devtools::install_github("PietroPiu-labstats/rareflow")Girsanov Tilting
b <- function(x) -x
dt <- 0.01
T <- 1000
Winc <- rnorm(T, sd = sqrt(dt))
fit_gir <- fitflow_girsanov(
observed = Qobs,
drift = b,
Winc = Winc,
dt = dt,
pxgivenz = px
)Freidlin–Wentzell Quasi-Potential
b <- function(x) x - x^3
qp <- FW_quasipotential(-1, 1, drift = b, T = 200, dt = 0.01)
qp$actionDocumentation
Full documentation and examples are available in the package vignette:
vignette("rareflow")