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

Add string option for metrics #504

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add string option for metrics #504

wants to merge 2 commits into from

Conversation

stkistner
Copy link
Collaborator

@stkistner stkistner commented Feb 14, 2025

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:

image

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.

@ecomodeller
Copy link
Member

Do you have other examples than the peak ratio, where it would be relevant with additional output?

@stkistner
Copy link
Collaborator Author

Do you have other examples than the peak ratio, where it would be relevant with additional output?

Our "old" matlab repo included percentages relative to the observations mean, and a statement that SI is unbiased, e.g. here is a full example, taken from the Matlab equivalent:
image

@daniel-caichac-DHI
Copy link
Collaborator

daniel-caichac-DHI commented Feb 14, 2025

I agree that the (unbiased) str is another good example.
The %'s are kind of random if you ask me, because it is a % of what? 4.7% bias is defined how exactly...
or the one that puzzles me the most is the % next to the mean
mean = 104.7% .... ??

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
Copy link
Member

But maybe it belongs more generally to the SkillTable than just the skill table next to the scatter plot... ?

@stkistner
Copy link
Collaborator Author

I agree that the (unbiased) str is another good example. The %'s are kind of random if you ask me, because it is a % of what? 4.7% bias is defined how exactly... or the one that puzzles me the most is the % next to the mean mean = 104.7% .... ??

The percentages are relative to the observation mean. I do not care that much for them, but can be useful still.

But maybe it belongs more generally to the SkillTable than just the skill table next to the scatter plot... ?

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as in this

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metric output is

str = f"{pr:.2f} (N={n_joint}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants