PINNs
physXAI.models.ann.pinn.pinn_loss
Functions
multi_y_loss(loss, additional_losses: list[float], name: str = None)
Creates a custom loss function that computes a weighted average of a base loss applied to a primary target and several additional targets.
This is useful for PINNs. The y
tensor is expected to have its first column (y[:, 0]
) as the primary target,
and subsequent columns (y[:, 1]
, y[:, 2]
, etc.) as additional targets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loss
|
callable
|
The base loss function (e.g., keras.losses.MeanSquaredError())
that takes |
required |
additional_losses
|
list of float
|
A list of weights.
Each weight |
required |
name
|
str
|
An optional name for the returned loss function.
Defaults to None, in which case the inner function's
default name ( |
None
|
Returns:
Name | Type | Description |
---|---|---|
callable |
A custom loss function that takes |
Source code in physXAI/models/ann/pinn/pinn_loss.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|