NVIDIA / modulus-sym

Framework providing pythonic APIs, algorithms and utilities to be used with Modulus core to physics inform model training as well as higher level abstraction for domain experts

Home Page:https://developer.nvidia.com/modulus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ›[BUG]: Validator L2 Relative Error Loss

BoomChawit opened this issue Β· comments

Version

v1.3.0

On which installation method(s) does this occur?

No response

Describe the issue

I would like to report an issue in modulus/sym/domain/validator/validator.py.

As in lines 39 - 42, the L2 relative error is written as

$$ e_{L^2} = \sqrt{\frac{ \frac{1}{N} \sum_{i} \left( u_{true_i} - u_{pred_i} \right)^2} {\frac{1}{N-\delta N} \sum_i \left(u_{true_i} - \overline{u}_{true}\right)^2}} $$

new_var["l2_relative_error_" + str(key)] = torch.sqrt(
                torch.mean(torch.square(true_var[key] - pred_var[key]))
                / torch.var(true_var[key])
            )

However, I understand that the L2 relative error is defined as

$$ e_{L^2} = \sqrt{ \frac{ \sum_{i} \left( u_{true_i}-u_{pred_i} \right)^2} {\sum_i \left(u_{true_i}\right)^2} } $$

new_var["l2_relative_error_" + str(key)] = torch.sqrt(
                torch.sum(torch.square(true_var[key] - pred_var[key]))
                /  torch.sum(torch.square(true_var[key]))
            )

Regarding the validation loss, I would like to bring up this concern. If I misunderstand the concept of the function, please correct my understanding. Thank you very much for your consideration.

Minimum reproducible example

No response

Relevant log output

No response

Environment details

No response

Other/Misc.

No response