An introduction to Physics Informed Machine Learning

Simonetta Bodojra
Data Reply IT | DataTech
8 min readJun 26, 2024
[Image generated with Adobe Firefly]

“Physics should be made as simple as possible but not simpler” — Albert Einstein

In the ever-evolving landscape of artificial intelligence and machine learning, a new paradigm is emerging that promises to revolutionize how we model complex systems: Physics Informed Machine Learning (PIML).

This innovative approach integrates physical laws and machine learning algorithms to create models that are both data-driven and physically consistent. This strategy addresses how to combine machine learning with physics for tasks such as designing new aircraft concepts or forecasting, simulating, and comprehending fluid flows and turbulence — important elements in comprehending weather patterns and climate change. Physics-informed machine learning will be a vital tool in our toolbox going forward in the research of climate change physics.

Machine learning has a long history, with roots in constructing models from data using optimization and regression techniques. For instance, early models of planetary motion were derived from observational data using primitive forms of these techniques. Today, the availability of vast amounts of data and advanced optimization algorithms has accelerated the progress of machine learning. However, traditional machine learning models primarily rely on data, often lacking the underlying understanding of physical processes. When developing machine learning models, experts in this subject sometimes leave out the decades of physics expertise that humans have accumulated, as well as the vast amount of understanding about how physical systems function. However, during the past five to ten years, it has become increasingly evident that, in order to get the advanced performance required on extremely complex systems, such as those found in engineering, natural sciences and biology, physics must actually be incorporated into the machine learning process.

Let’s focus on the specific steps involved in constructing a classic machine learning model by outlining five key stages that are commonly employed in the development of any machine learning model and understanding how we can incorporate principles of physics into each of these stages.

  1. Problem Definition: Begin by defining the problem to be modelled. This involves identifying inputs and outputs and understanding the relationship to be learned. For example, classifying images of dogs and cats into their respective categories. When modelling physical systems like pendulums or fluid flows, the choice of problem inherently incorporates physics principles.
  2. Data Gathering and Curation: Next, gather and curate the training data necessary to train the model. This involves acquiring sufficient and relevant data, potentially with labels (e.g., knowing which images are dogs and which are cats), which can be a costly and time-consuming process. When data comes from physical systems, it inherently embeds physics. This process may involve augmenting data to include symmetries or invariances that reflect physical properties.
  3. Architecture Design: Design the architecture of the model. This includes choosing a suitable type of neural network or other models (like SINDy or autoencoders) that can effectively capture the relationship between inputs and outputs. Different architectures are chosen based on the specific problem domain, such as using convolutional neural networks for image classification or recurrent neural networks for time series modeling. Different architectures are chosen based on specific physical principles, such as conserving energy in mechanical systems using Hamiltonian neural networks.
  4. Loss Function Definition: Craft a loss function that serves as an objective function to measure how well the model predicts the outputs for given inputs. This function typically includes terms that quantify the error between predicted and actual outputs, and may include regularization terms to enhance model performance. These functions often include terms that promote physical principles like simplicity and sparsity, which are crucial in describing physical phenomena accurately.
  5. Optimization: Finally, select an optimization algorithm to train the model. Optimization involves adjusting the parameters of the chosen architecture to minimize the loss function across the training data. Techniques like stochastic gradient descent, including variants like ADAM Optimizer, are commonly used to iteratively refine model parameters.

Each stage in this process offers opportunities to incorporate principles of physics, potentially leading to discoveries or enhancements in both machine learning and understanding underlying physical phenomena.

Problem Definition

Similar to the initial stages of scientific or engineering techniques, the problem definition stage is essential for the machine learning process. It involves outlining the issue in precise terms, figuring out why it needs to be addressed, and comprehending how the model will be applied. Usually, this stage begins with an overall idea or hypothesis, which may change when more information about the data is available and possible architectures that could address the issue becomes accessible. Similar to how traditional scientific and engineering processes iteratively improve experimental designs or simulations, the problem statement is frequently refined during the process. In an iterative process, concepts from experimental and numerical simulations in science are used to the process of hypothesis generation, data collection, model development, and hypothesis revision depending on results.

For example, digital twins can be seen as virtual representations of physical assets or systems that aim to mimic their real-world behaviour. Effective digital twins should respect physical laws and incorporate domain knowledge to accurately model real-world behaviour. This alignment ensures that digital twins are not just data-driven simulations but robust tools for decision-making and optimization. Indeed, they serve as computational models that can predict performance, maintenance needs, and operational behaviour based on real-time data.

Digital twins are constructed using a hierarchy of models at different levels of fidelity. This includes low-fidelity models that are computationally inexpensive but less accurate, as well as high-fidelity models that are more accurate but computationally expensive. Machine learning plays a crucial role in digital twins by bridging the gap between different fidelity models. It can act as a surrogate model that integrates data from various sources and predicts system behaviour more efficiently than traditional physics-based simulations alone. By leveraging machine learning within digital twins, engineers and researchers can achieve faster simulations, better predictions, and more efficient design iterations.

Digital Twins as an example of problem that can take advantage from embedding physics in it [Image Source]

Data Gathering and Curation

The process of curating data for machine learning models is critical for increasing model robustness and efficiency. Although there are many different types of data sources used in different applications, the main goal is to use physics to reduce dependency on large datasets, which is important in areas where data collection is expensive or scarce.
Data augmentation is a widely used technique to address limited datasets; nevertheless, within this framework, it can be executed using physical concepts like symmetry. In fluid dynamics, for example, adding rotated versions of data points to datasets can greatly improve model performance and increase the model’s applicability with fewer original data samples. This method not only complies with accepted physics principles but also improves machine learning models’ flexibility in practical applications.

Architecture Design, Loss Function Definition, Optimization

The integration of physics spans across architecture selection, custom loss function formulation, and the choice of optimization algorithms. These components are interconnected and often require tailored solutions to effectively capture physical phenomena in machine learning models. Examples like autoencoders for compressing high-dimensional data or using custom differential equations to describe system dynamics illustrate this integrated approach.

In machine learning, designing an architecture involves creating a framework that defines how inputs will be handled and transformed into useful outputs. This stage offers adaptability and innovation in establishing the domain of functions the model will investigate. Standard neural networks, such as recurrent or convolutional networks, as well as additional models, such as decision trees, gaussian mixture models, linear models, and generalized linear models, can all be found in architectures. Selecting an appropriate architecture is essential, particularly when incorporating physics into machine learning, since certain architectures are more adapted to managing small amounts of data or enforcing physical restrictions.

Once an architecture is selected, the next step is crafting a loss function. This function quantifies how well the model performs the task it’s designed for, such as predicting lift on an airfoil based on its geometry. The goal is to minimize this loss function by adjusting the model’s parameters through an optimization algorithm. Special terms in the loss function can enforce physical properties like energy conservation or symmetry, ensuring the model reflects these fundamental principles.

Optimization fine-tunes the model parameters to achieve the smallest possible error between predicted and actual outcomes on the training data. Constraint-based optimization techniques also play a crucial role in molding the model to adhere to specific physical constraints, thereby producing more accurate and reliable predictions aligned with real-world behaviours.

Thus, by carefully integrating physics at each stage, machine learning models can not only solve problems effectively but also provide deeper insights and understanding of complex physical systems.

Physics-Informed Neural Networks

Physics-Informed Neural Networks (PINNs) are the State-of-the-Art of physical informed machine learning. They combine neural networks with known physics equations, such as partial differential equations (PDEs).

PINNs operate by embedding physics principles directly into the neural network’s training process. This is achieved through a physics-informed loss function that penalizes deviations from the underlying physical laws. By leveraging automatic differentiation, PINNs enable the computation of partial derivatives within the network architecture itself, facilitating the enforcement of physical constraints during training and enabling the addition of a physics-informed loss function that penalizes deviations from known physical laws.

Example of physics-informed neural network for solving Navier–Stokes equations [Image Source]

Traditional neural network approaches for predicting physical phenomena often rely solely on data-driven training without explicit consideration of underlying physics. In contrast, PINNs explicitly incorporate these physics constraints, ensuring that predictions conform closely to the laws governing the system. This capability is particularly valuable in scenarios where data may be sparse or limited, as PINNs can effectively simulate physical behaviours beyond the training dataset.

Applications of PINNs range from fluid dynamics to electromagnetics and quantum systems, where accurate modelling of physical behaviours is crucial. They are particularly useful in scenarios with sparse or limited data, as the physics-informed loss function allows evaluation at virtual points, thereby extending the predictive capabilities beyond the training dataset.

Despite their advantages, PINNs have challenges. Optimizing these networks can be complex due to the interplay between data-driven and physics-driven loss terms. This can lead to stiffer optimization problems and potential overfitting. Understanding these nuances is critical for effectively applying PINNs in various scientific and engineering contexts.

Overall, PINNs represent a significant advancement in integrating machine learning with physics, offering a promising framework for improving the accuracy and reliability of predictive models in complex physical systems.

In conclusion, the combination of physics and neural networks represents an important milestone toward the understanding and modelling of complex systems in the domains of artificial intelligence and machine learning. Physics Informed Machine Learning is a paradigm change that combines data-driven insights with fundamental physics principles, resulting in more robust and trustworthy predictive models. The introduction of Physics-Informed Neural Networks is an example of this synergy, in which neural networks are infused with physics equations such as partial differential equations (PDEs).

--

--