InverseProblemPINN<T>

Models & Types · AiDotNet.PhysicsInformed.PINNs

Implements a Physics-Informed Neural Network for inverse problems (parameter identification).

Inheritance: NeuralNetworkBase<T> → InverseProblemPINN<T>

Implements: IGeneratedParameterRegistrar<T>

How It Works

For Beginners: Inverse problems are about discovering unknown parameters from observations. This is the opposite of forward problems where parameters are known.

Examples of Inverse Problems:

  1. Medical Imaging: Find tumor location from external measurements
  2. Material Science: Identify Young’s modulus from stress-strain data
  3. Geophysics: Determine subsurface properties from seismic data
  4. Finance: Calibrate model parameters from market prices

How InverseProblemPINN Works:

  1. Neural network learns the solution u(x,t)
  2. Additional trainable variables represent unknown parameters θ
  3. Both are trained together to minimize:
  • Data loss: ||u_predicted - u_observed||²
  • Physics loss: ||PDE_residual(u, θ)||²
  • Regularization: Prior knowledge about parameters

Key Advantages:

  • Handles noisy and sparse observations
  • Physics acts as regularization
  • No need for iterative PDE solves
  • Can quantify parameter uncertainty

Training Strategy:

  1. Initialize parameters near prior estimates
  2. Train with emphasis on physics initially
  3. Gradually increase data weight
  4. Use separate learning rates for network and parameters

Example

var architecture = new NeuralNetworkArchitecture<double>(
    InputType.OneDimensional, NeuralNetworkTaskType.Regression,
    inputSize: 2, outputSize: 1);
            
// What you measured: a temperature at each (x, t) you probed.
var observations = new[]
{
    (location: new[] { 0.25, 0.1 }, value: new[] { 0.82 }),
    (location: new[] { 0.50, 0.1 }, value: new[] { 0.95 }),
    (location: new[] { 0.75, 0.1 }, value: new[] { 0.80 })
};
            
// Recover the conductivity that explains them, starting the search at 0.5.
var problem = new HeatConductivityInverseProblem<double>(observations, initialGuess: 0.5);
            
// Insulated at both ends: no heat crosses the boundary.
var boundaryConditions = new IBoundaryCondition<double>[]
{
    new NeumannBoundaryCondition<double>(flux: 0.0, lowerBound: 0.0, upperBound: 1.0)
};
            
var pinn = new InverseProblemPINN<double>(architecture, problem, boundaryConditions);

Constructors

Constructor Summary
InverseProblemPINN(NeuralNetworkArchitecture<T> architecture, IInverseProblem<T> inverseProblem, IBoundaryCondition<T>[] boundaryConditions, IInitialCondition<T> initialCondition, InverseProblemOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) Initializes a new instance of the InverseProblemPINN.

Properties

Property Summary
IReadOnlyList<T[]> ParameterHistory { get; } Gets the parameter estimation history.
T[] Parameters { get; } Gets the current estimated parameter values.
bool SupportsTraining { get; }
string[] ParameterNames { get; } Gets the parameter names.

Methods

Method Summary
InverseProblemResult<T> Solve(int epochs, double learningRate, bool verbose) Solves the inverse problem to identify unknown parameters.
ModelMetadata<T> GetModelMetadata()
Tensor<T> ForwardWithMemory(Tensor<T> input)
Vector<T> GetGradients()