diff --git a/docs/source/_rst/_code.rst b/docs/source/_rst/_code.rst index 24ef44eb6..290629b31 100644 --- a/docs/source/_rst/_code.rst +++ b/docs/source/_rst/_code.rst @@ -248,3 +248,4 @@ Losses and Weightings PowerLoss WeightingInterface ScalarWeighting + NeuralTangentKernelWeighting diff --git a/pina/loss/ntk_weighting.py b/pina/loss/ntk_weighting.py index 92fd0028c..d8c947f06 100644 --- a/pina/loss/ntk_weighting.py +++ b/pina/loss/ntk_weighting.py @@ -17,9 +17,7 @@ class NeuralTangentKernelWeighting(WeightingInterface): Paris Perdikaris. *When and why PINNs fail to train: A neural tangent kernel perspective*. Journal of Computational Physics 449 (2022): 110768. - DOI: `10.1016/j.jcp.2021.110768 `_. - - + DOI: `10.1016 `_. """ @@ -29,6 +27,8 @@ def __init__(self, model, alpha=0.5): :param torch.nn.Module model: The neural network model. :param float alpha: The alpha parameter. + + :raises ValueError: If ``alpha`` is not between 0 and 1 (inclusive). """ super().__init__() @@ -43,7 +43,7 @@ def __init__(self, model, alpha=0.5): def aggregate(self, losses): """ - Weights the losses according to the Neural Tangent Kernel + Weight the losses according to the Neural Tangent Kernel algorithm. :param dict(torch.Tensor) input: The dictionary of losses.