Skip to content

ODE PDE Deep learning

droten edited this page Feb 10, 2021 · 4 revisions

Interface:

General question: should this function work for both ODEs and PDEs, or do we separate these methods? The interface below was formulated for ODEs, but could be extended to PDEs.

Arguments for __init__ method:

  • DepVars: List with names of dependent variables. For example, for a SIR compartmental model, DepVars=['S', 'I', 'R'].

  • IndVars: List with names of input (independent) variables. For example, just ['t'] for ODEs such as a SIR model.

  • Coeffs: List with names of parameters to be constrained by deep learning, for example ['beta', 'gamma'].

  • SolveFunc: Function with numerical solver. SolveFunc accepts the parameters and dependent variables for a given value of the independent variables (e.g., t), and computes the increment of the dependent variables at a point offset by step size h (e.g., t+h).

    Example solution for the SIR model using an Euler step:

    def solver (depval, indval, coeffs, step):
       incr={}
       N = depval['S'] + depval['I'] + depval['R']
       incr['S'] = -coeffs['beta'] * depval['S'] * depval['I'] / N * step
       incr['I'] = +coeffs['beta'] * depval['S'] * depval['I'] / N * step \
                   - coeffs['gamma'] * depval['I'] * step
       incr['R'] = +coeffs['gamma'] * depval['I'] * step
       return incr
    
    
    

Arguments for fit method:

  • Optimizer: Pytorch optimizer. If omitted, default optimizer is used.
  • depvals: Training data points for dependent variables (e.g., times 't'.
  • indvals: Training data points for independent variables, e.g. U, R and I.

The fit method constrains the values of the model coefficients. These are accessible using the method get_coeffs.

Arguments for predict method:

  • depvals: Values of independent variables for which to make a prediction.
  • indvals: Values of dependent values to predict.