Uh oh!
There was an error while loading. Please reload this page.
Add string option for metrics - #504
Conversation
ecomodeller
commented
Feb 14, 2025
Do you have other examples than the peak ratio, where it would be relevant with additional output? |
stkistner
commented
Feb 14, 2025
I agree that the (unbiased) str is another good example. but yeah not trying to butcher that plot, I think that the idea behind it is still worthy, and there could be more applications that we do not know yet |
jsmariegaard
commented
Feb 14, 2025
But maybe it belongs more generally to the SkillTable than just the skill table next to the scatter plot... ? |
stkistner
commented
Feb 14, 2025
The percentages are relative to the observation mean. I do not care that much for them, but can be useful still.
That is the longer (and better) option, but it will likely require some like an auxiliary metrics class / attribute. I'm not 100% what the solution would look like. If you think this is work pursuing we can look into it. |
| fmt = f".{precision}f" | ||
| fvalue = f"{rounded_value:{fmt}}" | ||
| else: | ||
| fvalue = str(value) |
There was a problem hiding this comment.
How would this work then, if I have a skill called for instance PR and the value is 1.17, how would you add the text on the right as you did in your example picture ?
There was a problem hiding this comment.
The metric output is
str=f"{pr:.2f} (N={n_joint}"There was a problem hiding this comment.
I mean... it works, but I guess it means that when creating a metric (eg BIAS) if I wanted something special (say BIAS_str)
instead of
def bias(obs: ArrayLike, model: ArrayLike) -> Any:
r"""Bias (mean error)
$$
bias=\frac{1}{n}\sum_{i=1}^n (model_i - obs_i)
$$
Range: $(-\infty, \infty)$; Best: 0
"""
assert obs.size == model.size
return np.mean(model - obs)
the user would need to do
def bias_str(obs: ArrayLike, model: ArrayLike) -> Any:
r"""Bias (mean error)
$$
bias=\frac{1}{n}\sum_{i=1}^n (model_i - obs_i)
$$
Range: $(-\infty, \infty)$; Best: 0
"""
assert obs.size == model.size
bias = np.mean(model - obs)
return f'bias {bias:.2f} this is a bias string'
?
I see nothing wrong with the current code addition, so I am pro-approving it, if @ecomodeller agrees
There was a problem hiding this comment.
I am not sure I get this, let's book a meeting to come up with a pragmatic solution.
stkistner
commented
Feb 20, 2025
stkistner
commented
Feb 28, 2025
@daniel-caichac-DHI / @ecomodeller , any comments? |
daniel-caichac-DHI
commented
Feb 28, 2025
daniel-caichac-DHI
left a comment
There was a problem hiding this comment.
I think it looks great so I will approve,
but I guess @ecomodeller should press merge, unless he has any comments
Uh oh!
There was an error while loading. Please reload this page.
| t = child | ||
| break | ||
| assert t._cells[1, 0]._text._text == custom_name1 |
There was a problem hiding this comment.
The skill table next to the scatter plot is starting to get complex enough that it deserves to be able to be tested independent from the scatter method.
stkistner
commented
Mar 7, 2025
@ecomodeller I've,
|
daniel-caichac-DHI
commented
Mar 11, 2025
@ecomodeller could we merge this now? or u still have comments? |





An idea for 'special metrics':
The concept is that metrics can also produce string outputs. The main purpose for this is to add auxiliary info to the metrics, e.g. for Peak Ratios we often would like to know how many peaks there were:
While not currently used in modelskill itself, but applications using modelskill.
The downside is once the value is set, rounding of numbers would be tricky... But I don't know of any alternative (quick) solution to provide auxiliary metrics without breaking everything.