# Deep-PrAE: Deep Probabilistic Rare Event Estimation

A neural network-based importance sampling framework for estimating extremely small probabilities of rare events (as small as $10^-24$). The method combines deep learning with dominating points identification for optimal importance sampling with theoretical guarantees. The table below maps each implementation example to the corresponding example label used in the paper.



| Implementation example | Corresponding example in the paper |

| Example 1: 2D Sigmoid Functions | Example 1 |

| Example 2: Complement of 5D Ball | Example 2 |

| Example 3: Random Walk Excursion | Additional Example 1 |

| Example 4: Non-Gaussian Distribution | Additional Example 2 |

| Example 5: Rare-event Set with Hole | Example 3 |

| Example 6: Intelligent Driving Safety | Example 4 |



## Quick Start

### Installation

```bash
# Clone the repository
git clone https://github.com/mansurarief/DeepPrAE-dev.git

python -m venv .venv
source .venv/bin/activate  

# Install dependencies
pip install -r requirements.txt

# Install the package in editable mode
pip install -e .
```



## Six Experiments

### 1\. 2D Sigmoid Functions

* **Problem**: $P(g(X) > \\gamma)$ with some nonlinear $g$ and $X \\sim N(\[5,5], 0.25I^{2 \\times 2}$)

```bash
python run\\\\\\\_all\\\\\\\_examples.py --examples 1 --gamma 1.8 --visualize
```

### 2\. Complement of 5D Ball

* **Problem**: $P(|X| \\geq \\gamma)$ in 5 dimensions, $X \\sim N(0, 0.5I^{5 \\times 5}$)

```bash
python run\\\\\\\_all\\\\\\\_examples.py --examples 2 --gamma 4.75
```

### 3\. Random Walk Excursion

\- \*\*Corresponding example in the paper\*\*: Additional Example 1

* **Problem**: $P(\\max\_t S\_t \\geq \\gamma)$ where $S\_t =$ cumulative sum, $X\_i \\sim N(0, 1), T=10$ time steps

```bash
python run\\\\\\\_all\\\\\\\_examples.py --examples 3
```

### 4\. Non-Gaussian Distribution

\- \*\*Corresponding example in the paper\*\*: Additional Example 2

* **Problem**: Exponential + Generalized Pareto marginals with Gaussian copula (Non-Gaussian Example)

```bash
python run\\\\\\\_all\\\\\\\_examples.py --examples 4
```

### 5\. Rare-event Set with Hole

\- \*\*Corresponding example in the paper\*\*: Example 3

* **Problem**: Set with hole, non-monotonic set (disconnected rare-event regions)

```bash
python run\\\\\\\_all\\\\\\\_examples.py --examples 5
```

### 6\. Intelligent Driving Safety

\- \*\*Corresponding example in the paper\*\*: Example 4

* **Problem**: Autonomous vehicle crash probability (high dimensional, complex dynamics)

```bash
python run\\\\\\\_all\\\\\\\_examples.py --examples 6
```

## Repository Structure

```
Deep-PRAE/
├── deepprae/                  # Main package
│   ├── core/                  # Core algorithm components
│   │   ├── algorithm.py       # Main Deep-PrAE algorithm
│   │   ├── networks.py        # Neural network architectures
│   │   ├── optimization.py    # Dominating point optimization
│   │   ├── sampling.py        # Proposal distribution sampling
│   │   └── estimation.py      # Probability estimation
│   ├── configs/               # Experiment configurations
│   │   └── experiment\\\\\\\_configs.py
│   ├── experiments/           # Six benchmark experiments
│   │   ├── example1\\\\\\\_2d\\\\\\\_sigmoid.py
│   │   ├── example2\\\\\\\_ball\\\\\\\_complement.py
│   │   ├── example3\\\\\\\_random\\\\\\\_walk.py
│   │   ├── example4\\\\\\\_non\\\\\\\_gaussian.py
│   │   ├── example5\\\\\\\_hole.py
│   │   └── example6\\\\\\\_intelligent\\\\\\\_driving.py
│   └── utils/                 # Utility functions
├── run\\\\\\\_all\\\\\\\_examples.py        # Unified script to run examples
├── requirements.txt           # Python dependencies
├── setup.py                   # Package setup
└── README.md                  # This file
```



## Dependency

* Gurobi 13.0, with unlimited size model (needed to solve MIP model)

