ode_TrainingIVP_soft

Functions which trains a model for solving a solveODE_IVP call with soft constraints implemented in TensorFlow.

While available to user, not meant to be used. Meant to be used through object returned from solveODE calls, where training file is selected through ode_trainingSelect

PINNtrain_IVP(de_points, inits, order, t0, epochs, eqn, net_layers, net_units, model)

Main function called by PINNtrainSelect_Standard when solving soft constraint IVP.

Parameters:
  • de_points (list) –

    Randomly sampled points for network to train with.

  • inits (list) –

    Inital values for network to learn

  • order (int) –

    Order of equation to be solved

  • t0 (float) –

    First value in user input t_bdry

  • epochs (int) –

    Number of epochs for network to train

  • eqn (string) –

    Equation to solve. User input eqn

  • net_layers (int) –

    Number of internal layers of network

  • net_units (int) –

    Number of nodes for each internal layer

  • model (PINN or None) –

    User input model. Defaulted to None and model created in function with call to ode_ModelFuncs

Returns:
  • epoch_loss( list ) –

    Total loss over training of model

  • ivp_loss( list ) –

    Inital Value loss over training of model

  • de_loss( list ) –

    Differential equation loss over training of model

  • model( PINN ) –

    Trained model to predict equation(s) over t

Packages data correctly and calls train_network_general_IVP in executing training routine, and handles optimization of the network.

train_network_general_IVP(odes, inits, order, model, gamma, eqnparam)

Function which does the training for a single epoch

Parameters:
  • odes (list) –

    Sampled de points network uses to train

  • inits (list) –

    Inital value points for learning initial value

  • order (int) –

    Order of equation to solve

  • model (PINN) –

    Model to train

  • gamma (float) –

    Weight of IV loss when added with DE loss

  • eqnparam (string) –

    Equation to solve.

Generates derivatives of model using automatic differentiation. Computes mean squared error of loss along odes points and for inital values.

Returns:
  • DEloss( list ) –

    Loss of training network to match function along odes points

  • IVloss( list ) –

    Loss of training network to match initial values

  • grads( array ) –

    Gradients of network for optimization