Training Strategies
MeshGraphNets.DerivativeTraining — Type
DerivativeTraining(; window_size = 0, random = true)Compares the prediction of the system with the derivative from the data (via finite differences). Useful for initial training of the system since it is faster than training with a solver.
Keyword Arguments
window_size = 0: Number of steps from each trajectory (starting at the beginning) that are used for training. If the number is zero then the whole trajectory is used.random = true: Whether the derivative samples should be shuffled before training.
MeshGraphNets.SolverTraining — Type
SolverTraining(tstart, dt, tstop, solver;
sense = GaussAdjoint(autojacvec = ZygoteVJP()), solargs...)The default solver based training that is normally used for NeuralODEs. Simulates the system from tstart to tstop and calculates the loss based on the difference between the prediction and the ground truth at the timesteps tstart:dt:tstop.
Arguments
tstart: Start time of the simulation.dt: Interval at which the simulation is saved.tstop: Stop time of the simulation.solver: Solver that is used for simulating the system.
Keyword Arguments
sense = GaussAdjoint(autojacvec = ZygoteVJP()): The sensitivity algorithm used for calculating sensitivities. Checkpointing is enabled by default for adaptive solvers.solargs: Keyword arguments that are passed on to the solver.
MeshGraphNets.SolverBatchTraining — Type
SolverBatchTraining(tstart, dt, tstop, interval_size, solver;
sense = GaussAdjoint(autojacvec = ZygoteVJP()), solargs...)Solver-based training that splits the trajectory into overlapping intervals and performs a separate training step for each interval. Consecutive intervals share their boundary point.
Arguments
tstart: Start time of the simulation.dt: Interval at which the simulation is saved.tstop: Stop time of the simulation.interval_size: Number of datapoints in each interval.solver: Solver that is used for simulating the system.
Keyword Arguments
sense = GaussAdjoint(autojacvec = ZygoteVJP()): The sensitivity algorithm used for calculating sensitivities. Checkpointing is enabled by default for adaptive solvers.solargs: Keyword arguments that are passed on to the solver.
MeshGraphNets.MultipleShooting — Type
MultipleShooting(tstart, dt, tstop, interval_size, solver;
sense = GaussAdjoint(autojacvec = ZygoteVJP()),
continuity_term = 100, solargs...)Similar to SolverTraining, but splits the trajectory into intervals that are solved independently and then combines them for loss calculation. Useful if the network tends to get stuck in a local minimum if SolverTraining is used.
Arguments
tstart: Start time of the simulation.dt: Interval at which the simulation is saved.tstop: Stop time of the simulation.interval_size: Number of datapoints in each independently solved interval.solver: Solver that is used for simulating the system.
Keyword Arguments
sense = GaussAdjoint(autojacvec = ZygoteVJP()): The sensitivity algorithm used for calculating sensitivities. Checkpointing is enabled by default for adaptive solvers.continuity_term = 100: Factor by which the error between points of consecutive intervals is multiplied.solargs: Keyword arguments that are passed on to the solver.