Skip to content

Add GPR functions and unit tests#4

Merged
nilsvu merged 1 commit into
sxs-collaboration:mainfrom
vtommasini:add-GPR-ml-functions
May 13, 2026
Merged

Add GPR functions and unit tests#4
nilsvu merged 1 commit into
sxs-collaboration:mainfrom
vtommasini:add-GPR-ml-functions

Conversation

@vtommasini
Copy link
Copy Markdown

@vtommasini vtommasini commented Nov 26, 2025

Partial merge of the Gaussian Process Regression (GPR) Library for predicting the radial expansion rate and radial velocity of BBH simulations, currently consisting only of the self contained ML class and functions (no eccentricity control related functions).

Contains the following:

  1. Model class, handles input data setup with initialization, normalization, and denormalization functions
  2. GPR model training function, which stores normalization statistics
  3. Prediction function, which returns the mean and uncertainty
  4. GPR pipeline, which encompasses training, prediction, plots, and output metrics

Unit tests covering training, prediction, normalization/denormalization, and pipeline functionality using synthetic sine wave data are included for sanity check.

Copilot AI review requested due to automatic review settings November 26, 2025 06:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a Gaussian Process Regression (GPR) machine learning library for predicting orbital parameters, consisting of a self-contained model class with normalization capabilities and associated training/prediction functions. The implementation includes comprehensive unit tests to validate functionality.

  • GPR model implementation with mixed RBF and Matern kernels, linear mean function, and input/output normalization
  • Training and prediction functions with stored normalization parameters
  • Complete pipeline function for training, prediction, visualization, and metrics reporting

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 17 comments.

File Description
GPR_library.py Implements GPRegressionModel class, training function with Adam optimizer and learning rate scheduling, prediction function with denormalization, and full pipeline with plotting capabilities
TestGPRLibrary.py Provides comprehensive unit tests covering training, prediction, normalization/denormalization, and pipeline functionality using synthetic sine wave data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread GPR_library.py
Comment thread TestGPRLibrary.py Outdated
Comment thread TestGPRLibrary.py Outdated
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py Outdated
Comment thread TestGPRLibrary.py Outdated
Comment thread TestGPRLibrary.py Outdated
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py Outdated
Copy link
Copy Markdown
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

Very nice code and useful tests, the comments are very helpful 👍 please fix these minor comments and also address the copilot review above.

Comment thread GPR_library.py
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py Outdated
Comment thread GPR_library.py
Comment thread GPR_library.py Outdated
Comment thread TestGPRLibrary.py Outdated
@vtommasini vtommasini force-pushed the add-GPR-ml-functions branch from 25487ec to 716fff2 Compare April 24, 2026 22:29
Copy link
Copy Markdown
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

Looks good. Please fix the few unresolved comments above. In particular, please explain the magic numbers. You can add comments explaining how you chose them, and give an idea how much you have tested different numbers. The idea is to give people editing the code an idea if these are finely tuned numbers that should not be touched, or barely explored at all and open for experimentation.

Then please squash all of your commits into one.

Copy link
Copy Markdown
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

Please squash your commit into one (including these changes). Please also rebase on the latest main branch, as the test you added wasn't run by GitHub. It will run automatically once you rebased.

Comment thread src/SimulationSupport/gpr.py Outdated
Comment thread src/SimulationSupport/gpr.py
Comment thread pyproject.toml
Comment thread tests/test_gpr.py Outdated
@vtommasini vtommasini force-pushed the add-GPR-ml-functions branch from c83edb7 to 60b6d9f Compare May 10, 2026 15:33
Copy link
Copy Markdown
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

The automated tests run now and pass 👍 Merging this now so we can move on with the next PRs. We can clarify or fix the question below in a follow-up (probably best to make the number of training iterations an input parameter with a default).

Comment thread src/SimulationSupport/gpr.py
@nilsvu nilsvu merged commit 1505ef9 into sxs-collaboration:main May 13, 2026
5 checks passed
@nilsvu nilsvu mentioned this pull request May 13, 2026
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.

3 participants