Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve num_regression with changes in percent #93

Open
arthursoprana opened this issue Apr 19, 2022 · 1 comment
Open

Improve num_regression with changes in percent #93

arthursoprana opened this issue Apr 19, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@arthursoprana
Copy link

arthursoprana commented Apr 19, 2022

Add relative change, use sign on errors

The first idea would be to add a fourth column besides obtained_..., expected_... and diff: relative change. It would print the relative error of the obtained, in relation with the expected. It would also change to use a sign on the error.

Example:

    obtained_U_gas [m/s]  expected_U_gas [m/s]              abs. diff         rel. diff (%)
E       1   0.00000526006928701   0.00092027745031029  -0.000915017381023 -99.428425711698500
E       2   0.00109742144185932   0.05314025093428264  -0.052042829492423 -97.934858374650000
E       3   0.10233425003713974   0.83767265449607820  -0.735338404458939 -87.783503557400900
E       4   1.50587844448218111   2.46949341632139818  -0.963614971839210 -39.020754842692900
E       5   3.85292939530965661   4.17226524036200175  -0.319335845052350  -7.653776225996680
E       6   6.48537098006507318   6.44999832744570334   0.035372652619370   0.548413361114436
E       7  10.33851199361759932   9.96422211906309130   0.374289874554410   3.756338127372090
E       8  15.91086496866478051  15.83790607275804696   0.072958895906700   0.460659986058339
E       9  28.43953100878306728  28.31184178336182455   0.127689225421200   0.451009956887510

Note: using rel_error_in_percent = (obtained - expected) / abs(expected) * 100. There may be other better equations.

How it is currently:

E          obtained_U_gas [m/s]  expected_U_gas [m/s]                 diff
E       1   0.00000526006928701   0.00092027745031029  0.00091501738102328
E       2   0.00109742144185932   0.05314025093428264  0.05204282949242332
E       3   0.10233425003713974   0.83767265449607820  0.73533840445893850
E       4   1.50587844448218111   2.46949341632139818  0.96361497183921707
E       5   3.85292939530965661   4.17226524036200175  0.31933584505234514
E       6   6.48537098006507318   6.44999832744570334  0.03537265261936984
E       7  10.33851199361759932   9.96422211906309130  0.37428987455450802
E       8  15.91086496866478051  15.83790607275804696  0.07295889590673355
E       9  28.43953100878306728  28.31184178336182455  0.12768922542124272

Add changes on statistical properties

Sometimes it maybe useful to only look at variations in statistical properties, so this could be added to the output:

    obtained_U_gas [m/s]  expected_U_gas [m/s]              abs. diff         rel. diff (%)
E       1   0.00000526006928701   0.00092027745031029  -0.000915017381023 -99.428425711698500
(...)
E       9  28.43953100878306728  28.31184178336182455   0.127689225421200   0.451009956887510
E     min   0.000005260069287     0.000920277450310    -0.000915017381023 -99.428425711698500
E     max  28.439531008783000    28.311841783361800     0.127689225421200   0.451009956887510
E     avg   7.404058191385600     7.566384460243630    -0.162326268858032  -2.145361099623600
E     std   9.582861811894490     9.369144876763070     0.213716935131419   2.281071943518240

I'll mention @tadeu here since he's the original author of this request 😃

@tadeu
Copy link
Member

tadeu commented Apr 19, 2022

Nice! Perhaps abs. diff might be confusing, since it's not an absolute value anymore (as in "using abs()")? Could it be called obtained - expected?

Good idea about the statistical properties. avg might be misleading over possibly negative values, as it could be near 0.0 in a case with plenty of errors symmetrically distributed.

@arthursoprana arthursoprana added the enhancement New feature or request label Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants