{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial: Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles\n", "\n", "[](https://colab.research.google.com/github/mathLab/PINA/blob/master/tutorials/tutorial14/tutorial.ipynb)\n", "\n", "This tutorial demonstrates how to use the Deep Ensemble Physics Informed Network (DeepEnsemblePINN) to learn PDEs exhibiting bifurcating behavior, as discussed in [*Learning and Discovering Multiple Solutions Using Physics-Informed Neural Networks with Random Initialization and Deep Ensemble*](https://arxiv.org/abs/2503.06320).\n", "\n", "Let’s begin by importing the necessary libraries." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "## routine needed to run the notebook on Google Colab\n", "try:\n", " import google.colab\n", "\n", " IN_COLAB = True\n", "except:\n", " IN_COLAB = False\n", "if IN_COLAB:\n", " !pip install \"pina-mathlab[tutorial]\"\n", "\n", "import torch\n", "import matplotlib.pyplot as plt\n", "import warnings\n", "\n", "from lightning.pytorch.callbacks import Callback\n", "\n", "from pina import Trainer, Condition, LabelTensor\n", "from pina.solver import DeepEnsemblePINN\n", "from pina.model import FeedForward\n", "from pina.operator import laplacian\n", "from pina.problem import TimeDependentProblem\n", "from pina.domain import CartesianDomain\n", "from pina.equation import Equation\n", "from pina.optim import TorchOptimizer\n", "\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Deep Ensemble\n", "\n", "Deep Ensemble methods improve model performance by leveraging the diversity of predictions generated by multiple neural networks trained on the same problem. Each network in the ensemble is trained independently—typically with different weight initializations or even slight variations in the architecture or data sampling. By combining their outputs (e.g., via averaging or majority voting), ensembles reduce overfitting, increase robustness, and improve generalization.\n", "\n", "This approach allows the ensemble to capture different perspectives of the problem, leading to more accurate and reliable predictions.\n", "\n", "
\n",
"
\n",
"