-
Notifications
You must be signed in to change notification settings - Fork 1
Add GPR functions and unit tests #4
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,333 @@ | ||||||||||||||
| # Distributed under the MIT License. | ||||||||||||||
| # See LICENSE.txt for details. | ||||||||||||||
|
|
||||||||||||||
| # Gaussian Process Regression Machine Learning Function Library | ||||||||||||||
| # contains all functions necessary to run the GPR Model | ||||||||||||||
| # used to predict better low-eccentricity orbital parameter initial guesses | ||||||||||||||
| # functions: | ||||||||||||||
| # 1. normalize_data | ||||||||||||||
| # 2. denormalize_predictions | ||||||||||||||
| # 3. omega_and_adot | ||||||||||||||
| # 4. omegaAndAdot | ||||||||||||||
| # 5. polynomial_fit_with_confidence | ||||||||||||||
| # 6. GPRegressionModel (class) | ||||||||||||||
| # 7. train_gpr_model | ||||||||||||||
| # 8. predict_with_gpr_model | ||||||||||||||
| # 9. run_gpr_pipeline | ||||||||||||||
| # 10. train_model_and_eigenvalue_analysis | ||||||||||||||
| # 11. loo_predictions | ||||||||||||||
| # 12. parse_test_runs | ||||||||||||||
| # 13. apply_gpr_corrections | ||||||||||||||
| # 14. save_gpr_corrected | ||||||||||||||
| # 15. loo_crossval | ||||||||||||||
| # 16. plot_loo_residuals | ||||||||||||||
|
|
||||||||||||||
| import argparse | ||||||||||||||
|
|
||||||||||||||
| import gpytorch | ||||||||||||||
| import matplotlib.pyplot as plt | ||||||||||||||
| import numpy as np | ||||||||||||||
| import pandas as pd | ||||||||||||||
|
||||||||||||||
| import pandas as pd |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The learning rate value 0.05 is a magic number that should be extracted as a named constant or parameter for better maintainability and easier tuning.
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The training iteration count 200 is a magic number that should be extracted as a named constant or parameter for better maintainability and to allow easier experimentation with training duration.
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plot parameter in the docstring is missing a type annotation. Should be plot (bool): Whether to produce correlation plots. for consistency with other parameters.
| plot: whether to produce correlation plots. | |
| silent: whether to suppress print statements entirely. | |
| plot (bool): Whether to produce correlation plots. | |
| silent (bool): Whether to suppress print statements entirely. |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The silent parameter in the docstring is missing a type annotation. Should be silent (bool): Whether to suppress print statements entirely. for consistency with other parameters.
| silent: whether to suppress print statements entirely. | |
| silent (bool): Whether to suppress print statements entirely. |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring states the function returns 4 values (model, likelihood, Y_pred, uncertainties), but the actual return statement on line 310 only returns 3 values (model, likelihood, Y_pred). The docstring should be corrected to match the implementation.
| uncertainties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function list in the header comment (lines 7-24) lists 16 functions, but only 4 are actually present in this file (GPRegressionModel class, train_gpr_model, predict_with_gpr_model, run_gpr_pipeline). This documentation is misleading and should be updated to reflect only the functions that are actually implemented.