autoemulate 2.1.1__tar.gz → 2.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. {autoemulate-2.1.1 → autoemulate-2.1.2}/PKG-INFO +8 -7
  2. {autoemulate-2.1.1 → autoemulate-2.1.2}/README.md +5 -4
  3. autoemulate-2.1.2/autoemulate/learners/__init__.py +8 -0
  4. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/transforms/base.py +0 -13
  5. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate.egg-info/PKG-INFO +8 -7
  6. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate.egg-info/SOURCES.txt +0 -4
  7. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate.egg-info/requires.txt +2 -2
  8. {autoemulate-2.1.1 → autoemulate-2.1.2}/pyproject.toml +7 -3
  9. autoemulate-2.1.1/autoemulate/experimental/data/spatiotemporal_dataset.py +0 -160
  10. autoemulate-2.1.1/autoemulate/experimental/emulators/fno.py +0 -100
  11. autoemulate-2.1.1/autoemulate/experimental/emulators/spatiotemporal.py +0 -98
  12. autoemulate-2.1.1/autoemulate/experimental/neural_processes/conditional_neural_process.py +0 -502
  13. autoemulate-2.1.1/autoemulate/learners/__init__.py +0 -36
  14. {autoemulate-2.1.1 → autoemulate-2.1.2}/LICENSE +0 -0
  15. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/__init__.py +0 -0
  16. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/__init__.py +0 -0
  17. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/base.py +0 -0
  18. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/bayes.py +0 -0
  19. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/evidence.py +0 -0
  20. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/history_matching.py +0 -0
  21. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/history_matching_dashboard.py +0 -0
  22. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/calibration/interval_excursion_set.py +0 -0
  23. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/callbacks/early_stopping.py +0 -0
  24. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/__init__.py +0 -0
  25. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/compare.py +0 -0
  26. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/device.py +0 -0
  27. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/logging_config.py +0 -0
  28. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/metrics.py +0 -0
  29. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/model_selection.py +0 -0
  30. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/plotting.py +0 -0
  31. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/reinitialize.py +0 -0
  32. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/results.py +0 -0
  33. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/save.py +0 -0
  34. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/sensitivity_analysis.py +0 -0
  35. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/tuner.py +0 -0
  36. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/core/types.py +0 -0
  37. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/data/utils.py +0 -0
  38. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/__init__.py +0 -0
  39. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac1/description.md +0 -0
  40. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac1/processed/outputs.csv +0 -0
  41. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac1/processed/parameters.csv +0 -0
  42. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac1/raw/outputs.csv +0 -0
  43. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac1/raw/parameters.csv +0 -0
  44. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac2/description.md +0 -0
  45. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac2/processed/outputs.csv +0 -0
  46. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac2/processed/parameters.csv +0 -0
  47. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac2/raw/outputs.csv +0 -0
  48. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac2/raw/parameters.csv +0 -0
  49. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac3/description.md +0 -0
  50. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac3/processed/outputs.csv +0 -0
  51. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac3/processed/parameters.csv +0 -0
  52. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac3/raw/outputs.csv +0 -0
  53. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac3/raw/parameters.csv +0 -0
  54. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac4/description.md +0 -0
  55. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac4/processed/outputs.csv +0 -0
  56. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac4/processed/parameters.csv +0 -0
  57. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac4/raw/outputs.csv +0 -0
  58. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac4/raw/parameters.csv +0 -0
  59. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac5/description.md +0 -0
  60. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac5/processed/outputs.csv +0 -0
  61. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac5/processed/parameters.csv +0 -0
  62. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac5/raw/passive_mechanics/outputs.csv +0 -0
  63. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac5/raw/passive_mechanics/parameters.csv +0 -0
  64. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac5/raw/passive_mechanics.tar.xz +0 -0
  65. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac6/description.md +0 -0
  66. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac6/processed/outputs.csv +0 -0
  67. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac6/processed/parameters.csv +0 -0
  68. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac6/raw/outputs.csv +0 -0
  69. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/cardiac6/raw/parameters.csv +0 -0
  70. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/climate1/description.md +0 -0
  71. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/climate1/processed/outputs.csv +0 -0
  72. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/climate1/processed/parameters.csv +0 -0
  73. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/climate1/raw/Holden2018.csv +0 -0
  74. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/datasets.py +0 -0
  75. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/engineering1/description.md +0 -0
  76. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/engineering1/processed/outputs.csv +0 -0
  77. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/engineering1/processed/parameters.csv +0 -0
  78. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/engineering1/raw/Nervi_truss_datasets.zip +0 -0
  79. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/engineering1/raw/datasets/Sobol_CSV_data_1000.csv +0 -0
  80. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/reactiondiffusion1/processed/outputs.csv +0 -0
  81. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/datasets/reactiondiffusion1/processed/parameters.csv +0 -0
  82. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/__init__.py +0 -0
  83. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/base.py +0 -0
  84. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/ensemble.py +0 -0
  85. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/gaussian_process/__init__.py +0 -0
  86. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/gaussian_process/exact.py +0 -0
  87. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/gaussian_process/kernel.py +0 -0
  88. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/gaussian_process/mean.py +0 -0
  89. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/gaussian_process/poly_mean.py +0 -0
  90. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/gradient_boosting.py +0 -0
  91. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/lightgbm.py +0 -0
  92. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/nn/__init__.py +0 -0
  93. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/nn/mlp.py +0 -0
  94. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/polynomials.py +0 -0
  95. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/radial_basis_functions.py +0 -0
  96. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/random_forest.py +0 -0
  97. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/registry.py +0 -0
  98. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/svm.py +0 -0
  99. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/transformed/__init__.py +0 -0
  100. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/transformed/base.py +0 -0
  101. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/emulators/transformed/delta_method.py +0 -0
  102. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/experimental/data/gaussian.py +0 -0
  103. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/experimental/emulators/nn/gaussian_mlp.py +0 -0
  104. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/experimental/emulators/nn/zoib.py +0 -0
  105. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/feature_generation/polynomial_features.py +0 -0
  106. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/learners/base.py +0 -0
  107. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/learners/membership.py +0 -0
  108. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/learners/pool.py +0 -0
  109. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/learners/stream.py +0 -0
  110. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/__init__.py +0 -0
  111. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/advection_diffusion.py +0 -0
  112. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/base.py +0 -0
  113. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/double_pendulum.py +0 -0
  114. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/epidemic.py +0 -0
  115. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/flow_problem.py +0 -0
  116. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/projectile.py +0 -0
  117. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/reaction_diffusion.py +0 -0
  118. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/simulations/seir.py +0 -0
  119. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/transforms/__init__.py +0 -0
  120. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/transforms/pca.py +0 -0
  121. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/transforms/standardize.py +0 -0
  122. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/transforms/utils.py +0 -0
  123. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate/transforms/vae.py +0 -0
  124. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate.egg-info/dependency_links.txt +0 -0
  125. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate.egg-info/not-zip-safe +0 -0
  126. {autoemulate-2.1.1 → autoemulate-2.1.2}/autoemulate.egg-info/top_level.txt +0 -0
  127. {autoemulate-2.1.1 → autoemulate-2.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autoemulate
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A python package for semi-automated emulation
5
5
  Author: AutoEmulate contributors (see our GitHub page)
6
6
  License-Expression: MIT
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
  Requires-Dist: matplotlib>=3.7.2
22
22
  Requires-Dist: seaborn>=0.12.2
23
- Requires-Dist: scikit-learn<1.6.0,>=1.3.0
23
+ Requires-Dist: scikit-learn>=1.3.0
24
24
  Requires-Dist: pandas>=2.1
25
25
  Requires-Dist: torch>=2.1.0
26
26
  Requires-Dist: scipy>=1.11.3
@@ -36,7 +36,7 @@ Requires-Dist: anytree>=2.12.1
36
36
  Requires-Dist: torchmetrics>=1.7.1
37
37
  Requires-Dist: pyro-ppl>=1.9.1
38
38
  Requires-Dist: torchrbf>=0.0.1
39
- Requires-Dist: arviz>=0.21.0
39
+ Requires-Dist: arviz<1.0,>=0.21.0
40
40
  Requires-Dist: getdist>=1.7.2
41
41
  Requires-Dist: einops>=0.8.1
42
42
  Requires-Dist: harmonic>=1.3.0
@@ -87,7 +87,7 @@ You can find the project documentation [here](https://alan-turing-institute.gith
87
87
 
88
88
  - The AutoEmulate project is run out of the [Alan Turing Institute](https://www.turing.ac.uk/).
89
89
  - Visit [autoemulate.com](https://www.autoemulate.com/) to learn more.
90
- - Feel free to reach out to us at [ai4physics@turing.ac.uk](mailto:ai4physics@turing.ac.uk) for queries about AutoEmulate or ideas for collaboration
90
+ - Feel free to reach out to us at [aiphys@turing.ac.uk](mailto:aiphys@turing.ac.uk) for queries about AutoEmulate or ideas for collaboration.
91
91
  - We have also published a paper in [The Journal of Open Source Software](https://joss.theoj.org/papers/10.21105/joss.07626).
92
92
 
93
93
  Please cite this paper if you use the package in your work:
@@ -137,14 +137,15 @@ You can find the project documentation [here](https://alan-turing-institute.gith
137
137
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/vchhabra-turing"><img src="https://avatars.githubusercontent.com/u/140401853?v=4?s=100" width="100px;" alt="vchhabra-turing"/><br /><sub><b>vchhabra-turing</b></sub></a><br /><a href="#ideas-vchhabra-turing" title="Ideas, Planning, & Feedback">🤔</a></td>
138
138
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/era-23"><img src="https://avatars.githubusercontent.com/u/115151590?v=4?s=100" width="100px;" alt="Ethan Attwood"/><br /><sub><b>Ethan Attwood</b></sub></a><br /><a href="#bug-era-23" title="Bug reports">🐛</a></td>
139
139
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/TheCSGuy25"><img src="https://avatars.githubusercontent.com/u/87066683?v=4?s=100" width="100px;" alt="__aar0n__.py"/><br /><sub><b>__aar0n__.py</b></sub></a><br /><a href="#code-TheCSGuy25" title="Code">💻</a></td>
140
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/SyedHaider2084"><img src="https://avatars.githubusercontent.com/u/227389830?v=4?s=100" width="100px;" alt="SyedHaider2084"/><br /><sub><b>SyedHaider2084</b></sub></a><br /><a href="#code-SyedHaider2084" title="Code">💻</a></td>
140
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/SyedHaider2084"><img src="https://avatars.githubusercontent.com/u/227389830?v=4?s=100" width="100px;" alt="SyedHaider2084"/><br /><sub><b>SyedHaider2084</b></sub></a><br /><a href="#code-SyedHaider2084" title="Code">💻</a> <a href="#doc-SyedHaider2084" title="Documentation">📖</a></td>
141
141
  </tr>
142
142
  <tr>
143
143
  <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/lcm98/"><img src="https://avatars.githubusercontent.com/u/102757707?v=4?s=100" width="100px;" alt="Loh Chun Mun"/><br /><sub><b>Loh Chun Mun</b></sub></a><br /><a href="#doc-cmsamaaa" title="Documentation">📖</a> <a href="#code-cmsamaaa" title="Code">💻</a></td>
144
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/z7076"><img src="https://avatars.githubusercontent.com/u/69681924?v=4?s=100" width="100px;" alt="Jichen Zhang"/><br /><sub><b>Jichen Zhang</b></sub></a><br /><a href="#code-z7076" title="Code">💻</a></td>
145
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/RemDelaporteMathurin"><img src="https://avatars.githubusercontent.com/u/40028739?v=4?s=100" width="100px;" alt="Rémi Delaporte-Mathurin"/><br /><sub><b>Rémi Delaporte-Mathurin</b></sub></a><br /><a href="#bug-RemDelaporteMathurin" title="Bug reports">🐛</a></td>
144
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/z7076"><img src="https://avatars.githubusercontent.com/u/69681924?v=4?s=100" width="100px;" alt="Jichen Zhang"/><br /><sub><b>Jichen Zhang</b></sub></a><br /><a href="#code-z7076" title="Code">💻</a> <a href="#doc-z7076" title="Documentation">📖</a></td>
145
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/RemDelaporteMathurin"><img src="https://avatars.githubusercontent.com/u/40028739?v=4?s=100" width="100px;" alt="Rémi Delaporte-Mathurin"/><br /><sub><b>Rémi Delaporte-Mathurin</b></sub></a><br /><a href="#bug-RemDelaporteMathurin" title="Bug reports">🐛</a> <a href="#doc-RemDelaporteMathurin" title="Documentation">📖</a></td>
146
146
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/pmeier"><img src="https://avatars.githubusercontent.com/u/6849766?v=4?s=100" width="100px;" alt="Philip Meier"/><br /><sub><b>Philip Meier</b></sub></a><br /><a href="#bug-pmeier" title="Bug reports">🐛</a></td>
147
147
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/penelopeysm"><img src="https://avatars.githubusercontent.com/u/122629585?v=4?s=100" width="100px;" alt="Penelope Yong"/><br /><sub><b>Penelope Yong</b></sub></a><br /><a href="#ideas-penelopeysm" title="Ideas, Planning, & Feedback">🤔</a> <a href="#review-penelopeysm" title="Reviewed Pull Requests">👀</a> <a href="#code-penelopeysm" title="Code">💻</a> <a href="#doc-penelopeysm" title="Documentation">📖</a></td>
148
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ykd007"><img src="https://avatars.githubusercontent.com/u/79036688?v=4?s=100" width="100px;" alt="Yash Dhawan"/><br /><sub><b>Yash Dhawan</b></sub></a><br /><a href="#doc-ykd007" title="Documentation">📖</a></td>
148
149
  </tr>
149
150
  </tbody>
150
151
  </table>
@@ -19,7 +19,7 @@ You can find the project documentation [here](https://alan-turing-institute.gith
19
19
 
20
20
  - The AutoEmulate project is run out of the [Alan Turing Institute](https://www.turing.ac.uk/).
21
21
  - Visit [autoemulate.com](https://www.autoemulate.com/) to learn more.
22
- - Feel free to reach out to us at [ai4physics@turing.ac.uk](mailto:ai4physics@turing.ac.uk) for queries about AutoEmulate or ideas for collaboration
22
+ - Feel free to reach out to us at [aiphys@turing.ac.uk](mailto:aiphys@turing.ac.uk) for queries about AutoEmulate or ideas for collaboration.
23
23
  - We have also published a paper in [The Journal of Open Source Software](https://joss.theoj.org/papers/10.21105/joss.07626).
24
24
 
25
25
  Please cite this paper if you use the package in your work:
@@ -69,14 +69,15 @@ You can find the project documentation [here](https://alan-turing-institute.gith
69
69
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/vchhabra-turing"><img src="https://avatars.githubusercontent.com/u/140401853?v=4?s=100" width="100px;" alt="vchhabra-turing"/><br /><sub><b>vchhabra-turing</b></sub></a><br /><a href="#ideas-vchhabra-turing" title="Ideas, Planning, & Feedback">🤔</a></td>
70
70
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/era-23"><img src="https://avatars.githubusercontent.com/u/115151590?v=4?s=100" width="100px;" alt="Ethan Attwood"/><br /><sub><b>Ethan Attwood</b></sub></a><br /><a href="#bug-era-23" title="Bug reports">🐛</a></td>
71
71
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/TheCSGuy25"><img src="https://avatars.githubusercontent.com/u/87066683?v=4?s=100" width="100px;" alt="__aar0n__.py"/><br /><sub><b>__aar0n__.py</b></sub></a><br /><a href="#code-TheCSGuy25" title="Code">💻</a></td>
72
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/SyedHaider2084"><img src="https://avatars.githubusercontent.com/u/227389830?v=4?s=100" width="100px;" alt="SyedHaider2084"/><br /><sub><b>SyedHaider2084</b></sub></a><br /><a href="#code-SyedHaider2084" title="Code">💻</a></td>
72
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/SyedHaider2084"><img src="https://avatars.githubusercontent.com/u/227389830?v=4?s=100" width="100px;" alt="SyedHaider2084"/><br /><sub><b>SyedHaider2084</b></sub></a><br /><a href="#code-SyedHaider2084" title="Code">💻</a> <a href="#doc-SyedHaider2084" title="Documentation">📖</a></td>
73
73
  </tr>
74
74
  <tr>
75
75
  <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/lcm98/"><img src="https://avatars.githubusercontent.com/u/102757707?v=4?s=100" width="100px;" alt="Loh Chun Mun"/><br /><sub><b>Loh Chun Mun</b></sub></a><br /><a href="#doc-cmsamaaa" title="Documentation">📖</a> <a href="#code-cmsamaaa" title="Code">💻</a></td>
76
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/z7076"><img src="https://avatars.githubusercontent.com/u/69681924?v=4?s=100" width="100px;" alt="Jichen Zhang"/><br /><sub><b>Jichen Zhang</b></sub></a><br /><a href="#code-z7076" title="Code">💻</a></td>
77
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/RemDelaporteMathurin"><img src="https://avatars.githubusercontent.com/u/40028739?v=4?s=100" width="100px;" alt="Rémi Delaporte-Mathurin"/><br /><sub><b>Rémi Delaporte-Mathurin</b></sub></a><br /><a href="#bug-RemDelaporteMathurin" title="Bug reports">🐛</a></td>
76
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/z7076"><img src="https://avatars.githubusercontent.com/u/69681924?v=4?s=100" width="100px;" alt="Jichen Zhang"/><br /><sub><b>Jichen Zhang</b></sub></a><br /><a href="#code-z7076" title="Code">💻</a> <a href="#doc-z7076" title="Documentation">📖</a></td>
77
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/RemDelaporteMathurin"><img src="https://avatars.githubusercontent.com/u/40028739?v=4?s=100" width="100px;" alt="Rémi Delaporte-Mathurin"/><br /><sub><b>Rémi Delaporte-Mathurin</b></sub></a><br /><a href="#bug-RemDelaporteMathurin" title="Bug reports">🐛</a> <a href="#doc-RemDelaporteMathurin" title="Documentation">📖</a></td>
78
78
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/pmeier"><img src="https://avatars.githubusercontent.com/u/6849766?v=4?s=100" width="100px;" alt="Philip Meier"/><br /><sub><b>Philip Meier</b></sub></a><br /><a href="#bug-pmeier" title="Bug reports">🐛</a></td>
79
79
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/penelopeysm"><img src="https://avatars.githubusercontent.com/u/122629585?v=4?s=100" width="100px;" alt="Penelope Yong"/><br /><sub><b>Penelope Yong</b></sub></a><br /><a href="#ideas-penelopeysm" title="Ideas, Planning, & Feedback">🤔</a> <a href="#review-penelopeysm" title="Reviewed Pull Requests">👀</a> <a href="#code-penelopeysm" title="Code">💻</a> <a href="#doc-penelopeysm" title="Documentation">📖</a></td>
80
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ykd007"><img src="https://avatars.githubusercontent.com/u/79036688?v=4?s=100" width="100px;" alt="Yash Dhawan"/><br /><sub><b>Yash Dhawan</b></sub></a><br /><a href="#doc-ykd007" title="Documentation">📖</a></td>
80
81
  </tr>
81
82
  </tbody>
82
83
  </table>
@@ -0,0 +1,8 @@
1
+ from autoemulate.learners.base import Emulator
2
+
3
+ from . import stream
4
+
5
+ # from .base import Emulator, Simulator
6
+ from .base import Simulator
7
+
8
+ __all__ = ["Emulator", "Simulator", "stream"]
@@ -613,16 +613,3 @@ def _is_affine_empirical(transform: Transform, x: TensorLike) -> bool:
613
613
  for _ in range(AFFINE_TRIALS):
614
614
  errs.append(_measure_affine_err(transform, test_input)) # type: ignore as Tensor input will transform to Tensor output
615
615
  return (sum(errs) / len(errs)) < AFFINE_TOL
616
-
617
-
618
- # TODO (#536): complete implementation
619
- # class AutoEmulateTransformModule(TransformModule):
620
- # @abstractmethod
621
- # def fit(self, x): ...
622
- # def _inverse_gaussian(self, y: GaussianLike) -> GaussianLike:
623
- # msg = "This method should be implemented in subclasses."
624
- # raise NotImplementedError(msg)
625
-
626
- # def _inverse_sample(self, y: GaussianLike, n_samples: int = 100) -> GaussianLike:
627
- # msg = "This method should be implemented in subclasses."
628
- # raise NotImplementedError(msg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autoemulate
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: A python package for semi-automated emulation
5
5
  Author: AutoEmulate contributors (see our GitHub page)
6
6
  License-Expression: MIT
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
  Requires-Dist: matplotlib>=3.7.2
22
22
  Requires-Dist: seaborn>=0.12.2
23
- Requires-Dist: scikit-learn<1.6.0,>=1.3.0
23
+ Requires-Dist: scikit-learn>=1.3.0
24
24
  Requires-Dist: pandas>=2.1
25
25
  Requires-Dist: torch>=2.1.0
26
26
  Requires-Dist: scipy>=1.11.3
@@ -36,7 +36,7 @@ Requires-Dist: anytree>=2.12.1
36
36
  Requires-Dist: torchmetrics>=1.7.1
37
37
  Requires-Dist: pyro-ppl>=1.9.1
38
38
  Requires-Dist: torchrbf>=0.0.1
39
- Requires-Dist: arviz>=0.21.0
39
+ Requires-Dist: arviz<1.0,>=0.21.0
40
40
  Requires-Dist: getdist>=1.7.2
41
41
  Requires-Dist: einops>=0.8.1
42
42
  Requires-Dist: harmonic>=1.3.0
@@ -87,7 +87,7 @@ You can find the project documentation [here](https://alan-turing-institute.gith
87
87
 
88
88
  - The AutoEmulate project is run out of the [Alan Turing Institute](https://www.turing.ac.uk/).
89
89
  - Visit [autoemulate.com](https://www.autoemulate.com/) to learn more.
90
- - Feel free to reach out to us at [ai4physics@turing.ac.uk](mailto:ai4physics@turing.ac.uk) for queries about AutoEmulate or ideas for collaboration
90
+ - Feel free to reach out to us at [aiphys@turing.ac.uk](mailto:aiphys@turing.ac.uk) for queries about AutoEmulate or ideas for collaboration.
91
91
  - We have also published a paper in [The Journal of Open Source Software](https://joss.theoj.org/papers/10.21105/joss.07626).
92
92
 
93
93
  Please cite this paper if you use the package in your work:
@@ -137,14 +137,15 @@ You can find the project documentation [here](https://alan-turing-institute.gith
137
137
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/vchhabra-turing"><img src="https://avatars.githubusercontent.com/u/140401853?v=4?s=100" width="100px;" alt="vchhabra-turing"/><br /><sub><b>vchhabra-turing</b></sub></a><br /><a href="#ideas-vchhabra-turing" title="Ideas, Planning, & Feedback">🤔</a></td>
138
138
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/era-23"><img src="https://avatars.githubusercontent.com/u/115151590?v=4?s=100" width="100px;" alt="Ethan Attwood"/><br /><sub><b>Ethan Attwood</b></sub></a><br /><a href="#bug-era-23" title="Bug reports">🐛</a></td>
139
139
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/TheCSGuy25"><img src="https://avatars.githubusercontent.com/u/87066683?v=4?s=100" width="100px;" alt="__aar0n__.py"/><br /><sub><b>__aar0n__.py</b></sub></a><br /><a href="#code-TheCSGuy25" title="Code">💻</a></td>
140
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/SyedHaider2084"><img src="https://avatars.githubusercontent.com/u/227389830?v=4?s=100" width="100px;" alt="SyedHaider2084"/><br /><sub><b>SyedHaider2084</b></sub></a><br /><a href="#code-SyedHaider2084" title="Code">💻</a></td>
140
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/SyedHaider2084"><img src="https://avatars.githubusercontent.com/u/227389830?v=4?s=100" width="100px;" alt="SyedHaider2084"/><br /><sub><b>SyedHaider2084</b></sub></a><br /><a href="#code-SyedHaider2084" title="Code">💻</a> <a href="#doc-SyedHaider2084" title="Documentation">📖</a></td>
141
141
  </tr>
142
142
  <tr>
143
143
  <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/lcm98/"><img src="https://avatars.githubusercontent.com/u/102757707?v=4?s=100" width="100px;" alt="Loh Chun Mun"/><br /><sub><b>Loh Chun Mun</b></sub></a><br /><a href="#doc-cmsamaaa" title="Documentation">📖</a> <a href="#code-cmsamaaa" title="Code">💻</a></td>
144
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/z7076"><img src="https://avatars.githubusercontent.com/u/69681924?v=4?s=100" width="100px;" alt="Jichen Zhang"/><br /><sub><b>Jichen Zhang</b></sub></a><br /><a href="#code-z7076" title="Code">💻</a></td>
145
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/RemDelaporteMathurin"><img src="https://avatars.githubusercontent.com/u/40028739?v=4?s=100" width="100px;" alt="Rémi Delaporte-Mathurin"/><br /><sub><b>Rémi Delaporte-Mathurin</b></sub></a><br /><a href="#bug-RemDelaporteMathurin" title="Bug reports">🐛</a></td>
144
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/z7076"><img src="https://avatars.githubusercontent.com/u/69681924?v=4?s=100" width="100px;" alt="Jichen Zhang"/><br /><sub><b>Jichen Zhang</b></sub></a><br /><a href="#code-z7076" title="Code">💻</a> <a href="#doc-z7076" title="Documentation">📖</a></td>
145
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/RemDelaporteMathurin"><img src="https://avatars.githubusercontent.com/u/40028739?v=4?s=100" width="100px;" alt="Rémi Delaporte-Mathurin"/><br /><sub><b>Rémi Delaporte-Mathurin</b></sub></a><br /><a href="#bug-RemDelaporteMathurin" title="Bug reports">🐛</a> <a href="#doc-RemDelaporteMathurin" title="Documentation">📖</a></td>
146
146
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/pmeier"><img src="https://avatars.githubusercontent.com/u/6849766?v=4?s=100" width="100px;" alt="Philip Meier"/><br /><sub><b>Philip Meier</b></sub></a><br /><a href="#bug-pmeier" title="Bug reports">🐛</a></td>
147
147
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/penelopeysm"><img src="https://avatars.githubusercontent.com/u/122629585?v=4?s=100" width="100px;" alt="Penelope Yong"/><br /><sub><b>Penelope Yong</b></sub></a><br /><a href="#ideas-penelopeysm" title="Ideas, Planning, & Feedback">🤔</a> <a href="#review-penelopeysm" title="Reviewed Pull Requests">👀</a> <a href="#code-penelopeysm" title="Code">💻</a> <a href="#doc-penelopeysm" title="Documentation">📖</a></td>
148
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ykd007"><img src="https://avatars.githubusercontent.com/u/79036688?v=4?s=100" width="100px;" alt="Yash Dhawan"/><br /><sub><b>Yash Dhawan</b></sub></a><br /><a href="#doc-ykd007" title="Documentation">📖</a></td>
148
149
  </tr>
149
150
  </tbody>
150
151
  </table>
@@ -95,12 +95,8 @@ autoemulate/emulators/transformed/__init__.py
95
95
  autoemulate/emulators/transformed/base.py
96
96
  autoemulate/emulators/transformed/delta_method.py
97
97
  autoemulate/experimental/data/gaussian.py
98
- autoemulate/experimental/data/spatiotemporal_dataset.py
99
- autoemulate/experimental/emulators/fno.py
100
- autoemulate/experimental/emulators/spatiotemporal.py
101
98
  autoemulate/experimental/emulators/nn/gaussian_mlp.py
102
99
  autoemulate/experimental/emulators/nn/zoib.py
103
- autoemulate/experimental/neural_processes/conditional_neural_process.py
104
100
  autoemulate/feature_generation/polynomial_features.py
105
101
  autoemulate/learners/__init__.py
106
102
  autoemulate/learners/base.py
@@ -1,6 +1,6 @@
1
1
  matplotlib>=3.7.2
2
2
  seaborn>=0.12.2
3
- scikit-learn<1.6.0,>=1.3.0
3
+ scikit-learn>=1.3.0
4
4
  pandas>=2.1
5
5
  torch>=2.1.0
6
6
  scipy>=1.11.3
@@ -16,7 +16,7 @@ anytree>=2.12.1
16
16
  torchmetrics>=1.7.1
17
17
  pyro-ppl>=1.9.1
18
18
  torchrbf>=0.0.1
19
- arviz>=0.21.0
19
+ arviz<1.0,>=0.21.0
20
20
  getdist>=1.7.2
21
21
  einops>=0.8.1
22
22
  harmonic>=1.3.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "autoemulate"
3
- version = "2.1.1"
3
+ version = "2.1.2"
4
4
  description = "A python package for semi-automated emulation"
5
5
  license = "MIT"
6
6
  authors = [{ name = "AutoEmulate contributors (see our GitHub page)" }]
@@ -18,7 +18,7 @@ classifiers = [
18
18
  dependencies = [
19
19
  "matplotlib>=3.7.2",
20
20
  "seaborn>=0.12.2",
21
- "scikit-learn>=1.3.0,<1.6.0",
21
+ "scikit-learn>=1.3.0",
22
22
  "pandas>=2.1",
23
23
  "torch>=2.1.0",
24
24
  "scipy>=1.11.3",
@@ -34,7 +34,7 @@ dependencies = [
34
34
  "torchmetrics>=1.7.1",
35
35
  "pyro-ppl>=1.9.1",
36
36
  "torchrbf>=0.0.1",
37
- "arviz>=0.21.0",
37
+ "arviz>=0.21.0,<1.0",
38
38
  "getdist>=1.7.2",
39
39
  "einops>=0.8.1",
40
40
  "harmonic>=1.3.0",
@@ -125,6 +125,10 @@ filterwarnings = [
125
125
  "ignore:jax\\.interpreters\\.xla\\.pytype_aval_mappings is deprecated\\..*:DeprecationWarning:tensorflow_probability\\.python\\.internal\\.backend\\.jax\\.ops",
126
126
  # PyTorch MPS backend capability fallbacks are backend noise in tests.
127
127
  "ignore:The operator .* is not currently supported on the MPS backend.*:UserWarning",
128
+ # LightGBM automatically adds feature names to training data, which causes warnings when
129
+ # making predictions with unnamed data
130
+ # https://github.com/lightgbm-org/LightGBM/issues/6798
131
+ "ignore:X does not have valid feature names, but LGBMRegressor was fitted with feature names:UserWarning",
128
132
  ]
129
133
 
130
134
  [tool.pyright]
@@ -1,160 +0,0 @@
1
- import h5py
2
- import torch
3
- from autoemulate.core.types import TensorLike
4
- from torch.utils.data import Dataset
5
-
6
-
7
- class AutoEmulateDataset(Dataset):
8
- """A class for spatio-temporal datasets."""
9
-
10
- def __init__(
11
- self,
12
- data_path: str | None,
13
- data: dict | None = None,
14
- n_steps_input: int = 1,
15
- n_steps_output: int = 1,
16
- stride: int = 1,
17
- # TODO: support for passing data from dict
18
- input_channel_idxs: tuple[int, ...] | None = None,
19
- output_channel_idxs: tuple[int, ...] | None = None,
20
- dtype: torch.dtype = torch.float32,
21
- ):
22
- """
23
- Initialize the dataset.
24
-
25
- Parameters
26
- ----------
27
- data_path: str
28
- Path to the HDF5 file containing the dataset.
29
- n_steps_input: int
30
- Number of input time steps.
31
- n_steps_output: int
32
- Number of output time steps.
33
- stride: int
34
- Stride for sampling the data.
35
- data: dict | None
36
- Preloaded data. Defaults to None.
37
- input_channel_idxs: tuple[int, ...] | None
38
- Indices of input channels to use. Defaults to None.
39
- output_channel_idxs: tuple[int, ...] | None
40
- Indices of output channels to use. Defaults to None.
41
- dtype: torch.dtype
42
- Data type for tensors. Defaults to torch.float32.
43
- """
44
- self.dtype = dtype
45
- self.n_steps_input = n_steps_input
46
- self.n_steps_output = n_steps_output
47
- self.stride = stride
48
- self.input_channel_idxs = input_channel_idxs
49
- self.output_channel_idxs = output_channel_idxs
50
-
51
- # Read or parse data
52
- self.read_data(data_path) if data_path is not None else self.parse_data(data)
53
-
54
- # Destructured here
55
- (
56
- self.n_trajectories,
57
- self.n_timesteps,
58
- self.width,
59
- self.height,
60
- self.n_channels,
61
- ) = self.data.shape
62
-
63
- # Pre-compute all subtrajectories for efficient indexing
64
- self.all_input_fields = []
65
- self.all_output_fields = []
66
- self.all_constant_scalars = []
67
-
68
- for traj_idx in range(self.n_trajectories):
69
- # Create subtrajectories for this trajectory
70
- fields = (
71
- self.data[traj_idx]
72
- .unfold(0, self.n_steps_input + self.n_steps_output, self.stride)
73
- .permute(0, -1, 1, 2, 3) # [num_subtrajectories, T_in + T_out, W, H, C]
74
- )
75
-
76
- # Split into input and output
77
- input_fields = fields[
78
- :, : self.n_steps_input, ...
79
- ] # [num_subtrajectories, T_in, W, H, C]
80
- output_fields = fields[
81
- :, self.n_steps_input :, ...
82
- ] # [num_subtrajectories, T_out, W, H, C]
83
-
84
- # Store each subtrajectory separately
85
- for sub_idx in range(input_fields.shape[0]):
86
- self.all_input_fields.append(
87
- input_fields[sub_idx].to(self.dtype)
88
- ) # [T_in, W, H, C]
89
- self.all_output_fields.append(
90
- output_fields[sub_idx].to(self.dtype)
91
- ) # [T_out, W, H, C]
92
-
93
- # Handle constant scalars
94
- if self.constant_scalars is not None:
95
- self.all_constant_scalars.append(
96
- self.constant_scalars[traj_idx].to(self.dtype)
97
- )
98
- else:
99
- self.all_constant_scalars.append(torch.tensor([]))
100
-
101
- print(f"Created {len(self.all_input_fields)} subtrajectory samples")
102
- print(f"Each input sample shape: {self.all_input_fields[0].shape}")
103
- print(f"Each output sample shape: {self.all_output_fields[0].shape}")
104
- print(f"Data type: {self.all_input_fields[0].dtype}")
105
-
106
- def read_data(self, data_path: str):
107
- """Read data.
108
-
109
- By default assumes HDF5 format in `data_path` with correct shape and fields.
110
- """
111
- # TODO: support passing as dict
112
- # Load data
113
- self.data_path = data_path
114
- with h5py.File(self.data_path, "r") as f:
115
- assert "data" in f, "HDF5 file must contain 'data' dataset"
116
- self.data: TensorLike = torch.Tensor(f["data"][:]).to(self.dtype) # type: ignore # [N, T, W, H, C] # noqa: PGH003
117
- print(f"Loaded data shape: {self.data.shape}")
118
- # TODO: add the constant scalars
119
- self.constant_scalars = (
120
- torch.Tensor(f["constant_scalars"][:]).to(self.dtype) # type: ignore # noqa: PGH003
121
- if "constant_scalars" in f
122
- else None
123
- ) # [N, C]
124
- # TODO: add the constant fields
125
- # self.constant_fields = torch.Tensor(f['data'][:]) # [N, W, H, C]
126
-
127
- def parse_data(self, data: dict | None):
128
- """Parse data from a dictionary."""
129
- if data is not None:
130
- self.data = (
131
- data["data"].to(self.dtype)
132
- if torch.is_tensor(data["data"])
133
- else torch.tensor(data["data"], dtype=self.dtype)
134
- )
135
- self.constant_scalars = data.get("constant_scalars", None)
136
- self.constant_fields = data.get("constant_fields", None)
137
- return
138
- msg = "No data provided to parse."
139
- raise ValueError(msg)
140
-
141
- def __len__(self): # noqa: D105
142
- return len(self.all_input_fields)
143
-
144
- def __getitem__(self, idx): # noqa: D105
145
- return {
146
- "input_fields": self.all_input_fields[idx],
147
- "output_fields": self.all_output_fields[idx],
148
- "constant_scalars": self.all_constant_scalars[idx],
149
- # TODO: add this
150
- # "constant_fields": self.all_constant_fields[idx],
151
- }
152
-
153
-
154
- class MHDDataset(AutoEmulateDataset):
155
- """PyTorch Dataset for MHD data."""
156
-
157
- def __init__(self, data_path: str, t_in: int = 5, t_out: int = 10, stride: int = 1):
158
- super().__init__(
159
- data_path, n_steps_input=t_in, n_steps_output=t_out, stride=stride
160
- )
@@ -1,100 +0,0 @@
1
- import torch
2
- from autoemulate.core.types import OutputLike, TensorLike
3
- from autoemulate.experimental.emulators.spatiotemporal import SpatioTemporalEmulator
4
- from neuralop.models import FNO
5
- from torch.utils.data import DataLoader
6
-
7
-
8
- def prepare_batch(sample, channels=(0,), with_constants=True, with_time=False):
9
- """Prepare a batch of input and output data."""
10
- # Get input fields, constant scalars and output fields
11
- x = sample["input_fields"][
12
- :, :, :, :, channels
13
- ] # [batch, time, height, width, len(channels)]
14
- constant_scalars = sample["constant_scalars"] # [batch, n_constants]
15
- y = sample["output_fields"][
16
- :, :, :, :, channels
17
- ] # [batch, time, height, width, len(channels)]
18
-
19
- # Permute both x and y
20
- x = x.permute(0, 4, 1, 2, 3) # [batch, len(channels), time, height, width]
21
- y = y.permute(0, 4, 1, 2, 3) # [batch, len(channels), time, height, width]
22
-
23
- # Only add constants to input, not output
24
- if with_constants:
25
- # Assign spatio-temporal dims to constants
26
- time_window, height, width = x.shape[2], x.shape[3], x.shape[4]
27
- n_constants = constant_scalars.shape[-1]
28
-
29
- # Add spatio-temporal dims to constants
30
- c_broadcast = constant_scalars.reshape(1, n_constants, 1, 1, 1).expand(
31
- 1, n_constants, time_window, height, width
32
- )
33
-
34
- # Concatenate along channel dimension
35
- x = torch.cat([x, c_broadcast], dim=1)
36
-
37
- if not with_time:
38
- # Take last time step for both input and output
39
- return x[:, :, -1, :, :], y[:, :, -1, :, :]
40
- # Otherwise include time
41
- return x, y
42
-
43
-
44
- class FNOEmulator(SpatioTemporalEmulator):
45
- """An FNO emulator."""
46
-
47
- def __init__(
48
- self, x=None, y=None, channels: tuple[int, ...] = (0,), *args, **kwargs
49
- ):
50
- _, _ = x, y # Unused
51
- # Ensure parent initialisers run before creating nn.Module attributes
52
- super().__init__()
53
- self.model = FNO(**kwargs)
54
- self.channels = channels
55
- self.optimizer = torch.optim.Adam(self.model.parameters())
56
-
57
- @staticmethod
58
- def is_multioutput() -> bool: # noqa: D102
59
- return True
60
-
61
- def _fit(self, x: TensorLike | DataLoader, y: TensorLike | None = None):
62
- assert isinstance(x, DataLoader), "x currently must be a DataLoader"
63
- assert y is None, "y currently must be None"
64
-
65
- for idx, batch in enumerate(x):
66
- # Prepare input with constants
67
- x, y = prepare_batch(
68
- batch, channels=self.channels, with_constants=True, with_time=True
69
- ) # type: ignore # noqa: PGH003
70
-
71
- # Predictions
72
- y_pred = self.model(x)
73
-
74
- # Get loss
75
- # Take the first time idx as the next time step prediction
76
- loss = self.loss_fn(y_pred[:, :, :1, ...], y)
77
-
78
- loss.backward()
79
- self.optimizer.step()
80
- self.optimizer.zero_grad()
81
-
82
- print(f"sample {idx:5d}, loss: {loss.item():.5e}")
83
-
84
- def forward(self, x: TensorLike):
85
- """Forward pass."""
86
- return self.model(x)
87
-
88
- def _predict(self, x: TensorLike | DataLoader, with_grad: bool) -> OutputLike:
89
- assert isinstance(x, DataLoader), "x currently must be a DataLoader"
90
- with torch.set_grad_enabled(with_grad):
91
- channels = (0,) # Which channel to use
92
- all_preds = []
93
- for _, batch in enumerate(x):
94
- # Prepare input with constants
95
- x, _ = prepare_batch(
96
- batch, channels=channels, with_constants=True, with_time=True
97
- )
98
- out = self(x)
99
- all_preds.append(out)
100
- return torch.cat(all_preds)
@@ -1,98 +0,0 @@
1
- from abc import abstractmethod
2
-
3
- import torch
4
- from autoemulate.core.types import OutputLike, TensorLike
5
- from autoemulate.emulators.base import PyTorchBackend
6
- from torch.utils.data import DataLoader
7
-
8
-
9
- class SpatioTemporalEmulator(PyTorchBackend):
10
- """A spatio-temporal backend for emulators."""
11
-
12
- channels: tuple[int, ...]
13
-
14
- def fit(self, x: TensorLike | DataLoader, y: TensorLike | None = None):
15
- """Train a spatio-temporal emulator.
16
-
17
- Parameters
18
- ----------
19
- x: TensorLike | DataLoader
20
- Input features as `TensorLike` or `DataLoader`.
21
- y: OutputLike | None
22
- Target values (not needed if x is a DataLoader).
23
-
24
- """
25
- if isinstance(x, TensorLike) and isinstance(y, TensorLike):
26
- return super().fit(x, y)
27
- if isinstance(x, DataLoader) and y is None:
28
- return self._fit(x, y)
29
- msg = "Invalid input types. Expected pair of TensorLike or DataLoader only."
30
- raise RuntimeError(msg)
31
-
32
- @abstractmethod
33
- def _fit(self, x: TensorLike | DataLoader, y: TensorLike | None = None): ...
34
-
35
- def predict(
36
- self,
37
- x: TensorLike | DataLoader,
38
- with_grad: bool = False,
39
- ) -> OutputLike:
40
- """Predict the output for the given input.
41
-
42
- Parameters
43
- ----------
44
- x: TensorLike | DataLoader
45
- Input `TensorLike` or `DataLoader` to make predictions for.
46
- with_grad: bool
47
- Whether to enable gradient calculation. Defaults to False.
48
-
49
- Returns
50
- -------
51
- OutputLike
52
- The emulator predicted spatiotemporal output.
53
- """
54
- if isinstance(x, TensorLike):
55
- return super().predict(x, with_grad)
56
- return self._predict(x, with_grad)
57
-
58
- @abstractmethod
59
- def _predict(self, x: TensorLike | DataLoader, with_grad: bool) -> OutputLike: ...
60
-
61
- # TODO: update to handle DataLoader input as part of #814 and #815
62
- def predict_autoregressive(self, initial_sample: dict, n_steps: int) -> TensorLike:
63
- """Perform autoregressive prediction."""
64
- from autoemulate.experimental.emulators.fno import ( # noqa: PLC0415 to avoid circular import
65
- prepare_batch,
66
- )
67
-
68
- self.eval()
69
- predictions = []
70
- # Get initial input
71
- current_input = initial_sample[
72
- "input_fields"
73
- ] # [batch, time, height, width, channels]
74
- constant_scalars = initial_sample["constant_scalars"]
75
- with torch.no_grad():
76
- for _ in range(n_steps):
77
- # Prepare current input in the format expected by prepare_batch
78
- current_sample = {
79
- "input_fields": current_input,
80
- "output_fields": current_input, # dummy, not used
81
- "constant_scalars": constant_scalars,
82
- }
83
- # Use prepare_batch to get properly formatted input
84
- x, _ = prepare_batch(
85
- current_sample,
86
- channels=self.channels,
87
- with_constants=True,
88
- with_time=True,
89
- )
90
- # Forward pass
91
- pred = self(x) # [batch, channels, time, height, width]
92
- assert isinstance(pred, TensorLike)
93
- predictions.append(pred)
94
- # Update input for next iteration
95
- # Convert prediction back to input format
96
- current_input = pred.permute(0, 2, 3, 4, 1)
97
- # Stack all predictions along time dimension
98
- return torch.cat(predictions, dim=2)