pihnn.utils.train#

pihnn.utils.train(boundary, model, n_epochs, learn_rate=0.001, scheduler_apply=[], scheduler_gamma=0.5, dir='results/')#

Performs the training of the neural network.

Parameters:
  • boundary (pihnn.geometries.boundary) – Domain boundary, needed to extract training and test points.

  • model (pihnn.nn.PIHNN/pihnn.nn.DD_PIHNN) – Neural network model.

  • n_epochs (int) – Number of total epochs.

  • learn_late – Initial learning rate for the optimizer.

  • scheduler_apply (list of int) – At which epoch to apply the torch.optim.lr_scheduler.ExponentialLR scheduler.

  • scheduler_gamma (float) – Scheduler exponential rate.

  • dir (str) – Directory where to save outputs.

Returns:

  • loss_epochs (list of float) - List containing the training loss at each epoch.

  • loss_epochs_test (list of float) - List containing the test loss at each epoch.