Scientific Machine Learning
This module contains functionality for Scientific Machine Learning methods supported in UQpy.
This package focuses on supervised machine learning, specifically on the architecture and training of neural networks.
This module is not intended as a standalone package for neural networks.
It is designed as an extension of PyTorch and, as much as practical,
we borrow their syntax and notation to implement UQ methods in a compatible way.
For example, the Bayesian counterpart of torch’s Linear layer is UQpy’s BayesianLinear layer,
which uses similar inputs.
The relationship between UQ4ML and ML4UQ.
The module contains the following parent classes for neural networks:
NormalBayesianLayer: Parent class to all Bayesian layers. Subclass ofLayer.ProbabilisticDropoutLayer: Parent class to all Dropout layers. Subclass ofLayer.Layer: Parent class to all Neural Network Layers. Subclass oftorch.nn.Module.Loss: Parent class to all Loss functions. Subclass oftorch.nn.Module.NeuralNetwork: Parent class to all Neural Networks and Neural Operators. Subclass oftorch.nn.Module.
Consistent with PyTorch’s architecture, those classes and their subclasses primarily organize and store tensors and parameters.
The bulk of the computation is done by the methods in the functional folder.
For example, the GaussianKullbackLeiblerDivergence class is used to define the divergence for a Bayesian neural
network, but hands off the actual divergence computation functional.gaussian_kullback_leibler_divergence.
To prevent naming conflicts with the common torch imports, we recommend importing this module as the following.
>>> import torch.nn as nn
>>> import torch.nn.functional as F
>>> import UQpy.scientific_machine_learning as sml # jokingly pronounced 'smile'
>>> import UQpy.scientific_machine_learning.functional as func