Skip to content

Commit

Permalink
Merge pull request #45 from jacopok/multiple-models
Browse files Browse the repository at this point in the history
Multiple models + HF/LF extension
  • Loading branch information
jacopok authored Oct 15, 2022
2 parents 998b400 + 853d0c9 commit d1d75dc
Show file tree
Hide file tree
Showing 18 changed files with 389 additions and 62 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ mlgw_bns/data_management.py
*.prof
profile_model_prediction.py
frequency_downsampling_histograms.py
!mlgw_bns/data/default_dataset_arrays.h5
!mlgw_bns/data/default_dataset_nn.pkl
!mlgw_bns/data/default_dataset_hyper.pkl
!mlgw_bns/data/*.h5
!mlgw_bns/data/*.pkl
!mlgw_bns/data/*.yaml
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- New functionality for [multiple default models](https://github.com/jacopok/mlgw_bns/pull/45)
- two models available: the `default` one and a `fast` one, trained from 5 and 15Hz respectively.
- `extend_with_post_newtonian` and `extend_with_zeros_at_high_frequency` flags for the `Model` class,
which determine whether to raise an exception or not when extending the model beyond its
training frequency range.

### Changed

- The `flatten_phase` method of the `Residuals` dataclass now returns the timeshifts
which the waveforms were shifted by, instead of `None`
- Call signature for the `Model.default` classmethod: now, the first available argument
is `model_name`, which determines which of the default provided models to use;
the keyword argument to use to choose the name to give to the current model is `filename`.

### Fixed

- Amplitude connection at low frequency: there is typically a (<1%) discrepancy in the EOB vs.
Post-Newtonian amplitude at the low frequency bound. Now, at frequencies lower than the minimum one,
the amplitude varies continuously, and reaches its PN value at half of the minimum frequency.

## [0.11.0] - 2022-09-19

### Added
Expand Down
10 changes: 9 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"sphinx.ext.autosectionlabel",
"sphinx.ext.viewcode",
"sphinx_search.extension",
"sphinxcontrib.bibtex"
"sphinxcontrib.bibtex",
"sphinx_autodoc_defaultargs"
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -49,6 +50,13 @@
# Add the bibliography
bibtex_bibfiles = ['refs.bib']

rst_prolog = """
.. |default| raw:: html
<div class="default-value-section">""" + \
' <span class="default-value-label">Default:</span>'


# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
Expand Down
52 changes: 52 additions & 0 deletions docs/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ @article{ajithDataFormatsNumerical2011
file = {/home/jacopo/Zotero/storage/9EXL7JMP/Ajith et al_2011_Data formats for numerical relativity waves.pdf;/home/jacopo/Zotero/storage/IEHLKX77/0709.html}
}

@article{akibaOptunaNextgenerationHyperparameter2019,
title = {Optuna: {{A Next-generation Hyperparameter Optimization Framework}}},
shorttitle = {Optuna},
author = {Akiba, Takuya and Sano, Shotaro and Yanase, Toshihiko and Ohta, Takeru and Koyama, Masanori},
year = {2019},
month = jul,
journal = {arXiv:1907.10902 [cs, stat]},
eprint = {1907.10902},
eprinttype = {arxiv},
primaryclass = {cs, stat},
abstract = {The purpose of this study is to introduce new design-criteria for next-generation hyperparameter optimization software. The criteria we propose include (1) define-by-run API that allows users to construct the parameter search space dynamically, (2) efficient implementation of both searching and pruning strategies, and (3) easy-to-setup, versatile architecture that can be deployed for various purposes, ranging from scalable distributed computing to light-weight experiment conducted via interactive interface. In order to prove our point, we will introduce Optuna, an optimization software which is a culmination of our effort in the development of a next generation optimization software. As an optimization software designed with define-by-run principle, Optuna is particularly the first of its kind. We will present the design-techniques that became necessary in the development of the software that meets the above criteria, and demonstrate the power of our new design through experimental results and real world applications. Our software is available under the MIT license (https://github.com/pfnet/optuna/).},
archiveprefix = {arXiv},
keywords = {Computer Science - Machine Learning,Statistics - Machine Learning},
file = {/home/jacopo/Zotero/storage/4UUVHB7I/Akiba et al_2019_Optuna.pdf;/home/jacopo/Zotero/storage/4FVKQDKP/1907.html}
}

@article{barsottiGravitationalWaveSurrogates2022,
title = {Gravitational Wave Surrogates through Automated Machine Learning},
author = {Barsotti, Dami{\'a}n and Cerino, Franco and Tiglio, Manuel and Villanueva, Aar{\'o}n},
Expand All @@ -34,6 +50,25 @@ @article{barsottiGravitationalWaveSurrogates2022
file = {/home/jacopo/Zotero/storage/QDR75ZQD/Barsotti et al. - 2022 - Gravitational wave surrogates through automated ma.pdf;/home/jacopo/Zotero/storage/TBGP6HKL/2110.html}
}

@article{damourFrequencydomainPapproximantFilters2000,
title = {Frequency-Domain {{P-approximant}} Filters for Time-Truncated Inspiral Gravitational Wave Signals from Compact Binaries},
author = {Damour, Thibault and Iyer, Bala R. and Sathyaprakash, B. S.},
year = {2000},
month = sep,
journal = {Physical Review D},
volume = {62},
number = {8},
eprint = {gr-qc/0001023},
eprinttype = {arxiv},
pages = {084036},
issn = {0556-2821, 1089-4918},
doi = {10.1103/PhysRevD.62.084036},
abstract = {Frequency-domain filters for time-windowed gravitational waves from inspiralling compact binaries are constructed which combine the excellent performance of our previously developed time-domain P-approximants with the analytic convenience of the stationary phase approximation without a serious loss in event rate. These Fourier-domain representations incorporate the ``edge oscillations'' due to the (assumed) abrupt shut-off of the time-domain signal caused by the relativistic plunge at the last stable orbit. These new analytic approximations, the SPP-approximants, are not only `effectual' for detection and `faithful' for parameter estimation, but are also computationally inexpensive to generate (and are `faster' by factors up to 10, as compared to the corresponding time-domain templates). The SPP approximants should provide data analysts the Fourier-domain templates for massive black hole binaries of total mass m less than about 40 solar mases, the most likely sources for LIGO and VIRGO.},
archiveprefix = {arXiv},
keywords = {General Relativity and Quantum Cosmology},
file = {/home/jacopo/Zotero/storage/43HGG988/Damour et al. - 2000 - Frequency-domain P-approximant filters for time-tr.pdf;/home/jacopo/Zotero/storage/MTPQM9AC/0001023.html}
}

@misc{etscienceteamEinsteinGravitationalWave2011,
title = {Einstein Gravitational Wave {{Telescope}} Conceptual Design Study},
author = {ET Science Team},
Expand Down Expand Up @@ -230,6 +265,23 @@ @article{ossokineMultipolarEffectiveOneBodyWaveforms2020
file = {/home/jacopo/Zotero/storage/BGK5UV6F/Ossokine et al. - 2020 - Multipolar Effective-One-Body Waveforms for Preces.pdf;/home/jacopo/Zotero/storage/E3ZUZE6M/2004.html}
}

@inproceedings{ozakiMultiobjectiveTreestructuredParzen2020,
title = {Multiobjective Tree-Structured Parzen Estimator for Computationally Expensive Optimization Problems},
booktitle = {Proceedings of the 2020 {{Genetic}} and {{Evolutionary Computation Conference}}},
author = {Ozaki, Yoshihiko and Tanigaki, Yuki and Watanabe, Shuhei and Onishi, Masaki},
year = {2020},
month = jun,
series = {{{GECCO}} '20},
pages = {533--541},
publisher = {{Association for Computing Machinery}},
address = {{New York, NY, USA}},
doi = {10.1145/3377930.3389817},
abstract = {Practitioners often encounter computationally expensive multiobjective optimization problems to be solved in a variety of real-world applications. On the purpose of challenging these problems, we propose a new surrogate-based multiobjective optimization algorithm that does not require a large evaluation budget. It is called Multiobjective Tree-structured Parzen Estimator (MOTPE) and is an extension of the tree-structured Parzen estimator widely used to solve expensive single-objective optimization problems. Our empirical evidences reveal that MOTPE can approximate Pareto fronts of many benchmark problems better than existing methods with a limited budget. In this paper, we discuss furthermore the influence of MOTPE configurations to understand its behavior.},
isbn = {978-1-4503-7128-5},
keywords = {bayesian optimization,computationally expensive optimization,infill criteria,machine learning,multiobjective optimization,surrogate modeling,tree-structured parzen estimator},
file = {/home/jacopo/Zotero/storage/GQC6KH85/Ozaki et al_2020_Multiobjective tree-structured parzen estimator for computationally expensive.pdf}
}

@article{purrerFrequencydomainReducedOrder2014,
title = {Frequency-Domain Reduced Order Models for Gravitational Waves from Aligned-Spin Compact Binaries},
author = {P{\"u}rrer, Michael},
Expand Down
5 changes: 2 additions & 3 deletions make_default_dataset.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from mlgw_bns import Model

def main_model():
m = Model("default_dataset", initial_frequency_hz=5.)
m = Model("default", initial_frequency_hz=5.)
m.generate(2 ** 10, 2 ** 16, 2 ** 17)
m.set_hyper_and_train_nn()
m.save(include_training_data=False)

def model_2():

m = Model("default_dataset_faster", initial_frequency_hz=15.)
m = Model("fast", initial_frequency_hz=15.)
m.generate(2 ** 10, 2 ** 16, 2 ** 17)
m.set_hyper_and_train_nn()
m.save(include_training_data=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ parameter_ranges:
- 3.0
pca_components_number: 30
srate_hz: 4096.0
extend_with_post_newtonian: true
extend_with_zeros_at_high_frequency: true
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions mlgw_bns/data/fast.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
initial_frequency_hz: 15.0
multibanding: true
parameter_ranges:
chi1_range: !!python/tuple
- -0.5
- 0.5
chi2_range: !!python/tuple
- -0.5
- 0.5
lambda1_range: !!python/tuple
- 5.0
- 5000.0
lambda2_range: !!python/tuple
- 5.0
- 5000.0
mass_range: !!python/tuple
- 2.0
- 4.0
q_range: !!python/tuple
- 1.0
- 3.0
pca_components_number: 30
srate_hz: 4096.0
extend_with_post_newtonian: true
extend_with_zeros_at_high_frequency: true
Binary file added mlgw_bns/data/fast_arrays.h5
Binary file not shown.
Binary file added mlgw_bns/data/fast_nn.pkl
Binary file not shown.
Loading

0 comments on commit d1d75dc

Please sign in to comment.