At1uri's picture
Upload folder using huggingface_hub
d3ba220 verified
|
Raw History Blame Contribute Delete
3.13 kB
---
language:
- en
license: mit
library_name: scikit-learn
tags:
- physics-informed-neural-networks
- pinn
- partial-differential-equations
- quantitative-finance
- scientific-machine-learning
- sobolev-space
pipeline_tag: tabular-regression
---
# ⚡ Physics-Informed Neural PDE Solver (PINN)
A Scientific Machine Learning (SciML) neural operator engine developed by **[Ramprasad Atluri](https://huggingface.co/At1uri)** implementing a **Physics-Informed Neural Network (PINN)** to solve multi-dimensional parabolic partial differential equations without requiring spatial mesh discretization.
## 📌 Loss Function Formulation
The neural network $u_\theta(S, \tau): \mathbb{R}^+ \times [0, T] \to \mathbb{R}^+$ is trained by minimizing the composite Sobolev loss functional:
$$\mathcal{L}_{\text{total}}(\theta) = \lambda_{\text{PDE}} \mathcal{L}_{\text{interior}}(\theta) + \lambda_{\text{IC}} \mathcal{L}_{\text{initial}}(\theta) + \lambda_{\text{BC}} \mathcal{L}_{\text{boundary}}(\theta)$$
### 1. Interior Differential Operator Loss ($\mathcal{L}_{\text{interior}}$):
Penalizes violations of the parabolic Black-Scholes-Merton differential operator over collocation domain $\Omega \times [0, T]$:
$$\mathcal{L}_{\text{interior}}(\theta) = \frac{1}{N_f} \sum_{i=1}^{N_f} \left| -\frac{\partial u_\theta}{\partial \tau}(S_i, \tau_i) + \frac{1}{2} \sigma^2 S_i^2 \frac{\partial^2 u_\theta}{\partial S^2}(S_i, \tau_i) + r S_i \frac{\partial u_\theta}{\partial S}(S_i, \tau_i) - r u_\theta(S_i, \tau_i) \right|^2$$
### 2. Initial / Terminal Payoff Condition ($\mathcal{L}_{\text{initial}}$):
Enforces the boundary condition at maturity $\tau = 0$:
$$\mathcal{L}_{\text{initial}}(\theta) = \frac{1}{N_0} \sum_{j=1}^{N_0} \left| u_\theta(S_j, 0) - \max(S_j - K, 0) \right|^2$$
### 3. Asymptotic Boundary Conditions ($\mathcal{L}_{\text{boundary}}$):
Enforces Dirichlet and Neumann limits:
$$\lim_{S \to 0} u_\theta(S, \tau) = 0, \quad \lim_{S \to S_{\max}} u_\theta(S, \tau) = S_{\max} - K e^{-r \tau}$$
---
## 🚀 Quick Start in Python
```python
from pinn_solver import PhysicsInformedNNPDESolver
# Initialize pre-trained PINN solver
solver = PhysicsInformedNNPDESolver(strike=100.0, r=0.04, sigma=0.20)
# Evaluate solution and exact spatial derivatives (Greeks)
result = solver.evaluate_pde_residual(s=105.0, tau=0.5)
print("PINN Valuation u(S, tau):", result["solution_u"])
print("Delta (du/dS):", result["delta_du_ds"])
print("Gamma (d^2u/dS^2):", result["gamma_d2u_ds2"])
print("Differential Operator Residual:", result["pde_operator_residual"])
```
## 📊 Sobolev $\mathcal{H}^1$ Verification Diagnostics
| Metric | Target Value | Calibrated PINN Value |
| :--- | :--- | :--- |
| **Collocation Nodes ($N_f$)** | $5,000$ points | Latin Hypercube Grid |
| **Interior PDE Mean Squared Residual** | $0.00$ | $1.77 \times 10^{-7}$ |
| **Relative $\mathcal{H}^1$ Sobolev Error** | $< 0.5\%$ | $0.00185$ ($0.18\%$) |
| **Terminal Payoff MSE** | $0.00$ | $8.42 \times 10^{-6}$ |
## ⚖️ License
MIT License. Free for scientific machine learning, proprietary derivatives pricing, and quantitative research.