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 mesmer_m example script #491

Merged
merged 20 commits into from
Aug 22, 2024

Conversation

veni-vidi-vici-dormivi
Copy link
Collaborator

Here an example script that executes the mesmer_m workflow for the coarse test dataset.

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.32%. Comparing base (f9735df) to head (90d484c).
Report is 48 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #491   +/-   ##
=======================================
  Coverage   50.32%   50.32%           
=======================================
  Files          50       50           
  Lines        3527     3527           
=======================================
  Hits         1775     1775           
  Misses       1752     1752           
Flag Coverage Δ
unittests 50.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Member

@mathause mathause left a comment

Choose a reason for hiding this comment

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

Thanks - the mesmer-m approach is now really concise and well readable. I am happy to merge as a script but I would eventually like to create notebooks that we can include in our documentation (ah but it's still 40s (on my laptop) which is long to run for a doc build).

  • do you know if Shruti ever fits more than one ensemble member and/ or scenario? Because this may not be possible in the current form 😬
  • would also be good to have an integration test from this script (but again the 40 s is very long for this)

@mathause
Copy link
Member

mathause commented Aug 8, 2024

I quickly timed the individual parts (to have a reference)

what duration
data loading 2s
mesmer.stats.fit_harmonic_model 9s
mesmer.stats.fit_yeo_johnson_transform 15s
mesmer.stats.find_localized_empirical_covariance_monthly 7s
emulations 2s

@veni-vidi-vici-dormivi
Copy link
Collaborator Author

Thanks - the mesmer-m approach is now really concise and well readable.

Thank you, I think so too, we did a good job 😊

I am happy to merge as a script but I would eventually like to create notebooks that we can include in our documentation (ah but it's still 40s (on my laptop) which is long to run for a doc build).

Hm yeah a notebook for the docs would be really cool. I would merge as is now and pretty it up later when we are done with the numerical issues.

do you know if Shruti ever fits more than one ensemble member and/ or scenario? Because this may not be possible in the current form 😬

I thought about that already and in the paper she writes that she uses only one scenario. If there are several members she splits them into a training and a test set and for some there are several members in the test set. I could not infer from the paper if the model is trained on several members together or for each member individually. The notebook provided for the paper definitely has no functionality to handle several members so the aggregation happened either before that or training happened separately and the evaluation statistics were then aggregated. We should ask her about it.

would also be good to have an integration test from this script (but again the 40 s is very long for this)

Hm we could try and do it with less years maybe. Interesting that the transformer is the slowest part, good to know. And cool to see that the emulation is very quick, that's nice.

@veni-vidi-vici-dormivi
Copy link
Collaborator Author

Okay I switched to a notebook now. It has lots of room for more commenting and some visualisations but we can do that later.

@mathause
Copy link
Member

mathause commented Aug 12, 2024

Thanks. Can you add two more titles: "Calibrate model", and "Find localized empirical covariance" and remove the inputs ("Clear all inputs")

@mathause
Copy link
Member

mathause commented Aug 19, 2024

I will add some more comments to the notebook - I will update it directly, so please don't do the same ;-)

Copy link
Member

@mathause mathause left a comment

Choose a reason for hiding this comment

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

Thanks - I approve but maybe you can read through quickly as well.

@veni-vidi-vici-dormivi
Copy link
Collaborator Author

but maybe you can read through quickly as well

Through what?

@mathause
Copy link
Member

but maybe you can read through quickly as well

Through what?

😮 oh I forgot to push my changes

@mathause
Copy link
Member

Ah no I pushed to origin instead of your fork

-git push origin HEAD
+git push vici HEAD

@veni-vidi-vici-dormivi
Copy link
Collaborator Author

I added some small details and some more info on the time coordinate, that we save. Actually that's only necessary when you want/need the time coordinate on the emulations to be the same as for the data but if that is not necessary one could also create one oneself.

@mathause mathause merged commit c94a5f1 into MESMER-group:main Aug 22, 2024
7 checks passed
@mathause
Copy link
Member

Thanks!

@veni-vidi-vici-dormivi veni-vidi-vici-dormivi deleted the m_example branch August 22, 2024 13:23
veni-vidi-vici-dormivi added a commit to veni-vidi-vici-dormivi/mesmer that referenced this pull request Aug 24, 2024
* add mesmer_m example script

* changelog

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove unused imports

* adjustments

* replace script with notebook

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* restructure and add some headings

* remove inputs

* add some comments

* typos

* date_range: update freq string (MESMER-group#504)

* date_range: update freq string

* add freq conditionals

* reference: only year as link (MESMER-group#505)

* nits

* more info on time coordinate

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update comment & clear output

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mathias Hauser <mathias.hauser@env.ethz.ch>
Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>
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.

2 participants