SelfAdaptiveWeighting#

Module for Self-Adaptive Weighting class.

class SelfAdaptiveWeighting(update_every_n_epochs=1)[source]#

Bases: WeightingInterface

A self-adaptive weighting scheme to tackle the imbalance among the loss components. This formulation equalizes the gradient norms of the losses, preventing bias toward any particular term during training.

See also

Original reference: Wang, S., Sankaran, S., Stinis., P., Perdikaris, P. (2025). Simulating Three-dimensional Turbulence with Physics-informed Neural Networks. DOI: arXiv preprint arXiv:2507.08972.

Initialization of the SelfAdaptiveWeighting class.

Parameters:

update_every_n_epochs (int) – The number of training epochs between weight updates. If set to 1, the weights are updated at every epoch. Default is 1.

weights_update(losses)[source]#

Update the weighting scheme based on the given losses.

Parameters:

losses (dict) – The dictionary of losses.

Returns:

The updated weights.

Return type:

dict