MyNixOS website logo
Description

Variational Flow-Based Inference for Rare Events and Large Deviations.

Variational flow-based methods for modeling rare events using Kullback–Leibler (KL) divergence, normalizing flows, Girsanov change of measure, and Freidlin–Wentzell action functionals. The package provides tools for rare-event inference, minimum-action paths, and quasi-potential computation in stochastic dynamical systems. Methods are based on Rezende and Mohamed (2015) <doi:10.48550/arXiv.1505.05770>, Girsanov (1960) <doi:10.1137/1105027>, and Freidlin and Wentzell (2012, ISBN:978-0387955477).

rareflow

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")

Quick Example

A minimal workflow for fitting a variational posterior using a planar flow:

library(rareflow)

Qobs <- c(0.05, 0.90, 0.05)
px <- function(z) c(0.3, 0.4, 0.3)

flow <- makeflow("planar")
fit <- fitflowvariational(Qobs, pxgivenz = px, nmc = 500)

fit$elbo

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$action

Documentation

Full documentation and examples are available in the package vignette:

vignette("rareflow")

Features

  • Variational inference with normalizing flows

  • Rare-event tilting via Girsanov

  • Minimum-action paths and quasi-potentials

  • Support for 1D and 2D systems

  • Modular flow architecture.

Metadata

Version

0.1.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows