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

Bug/jon/gp update #71

Merged
merged 4 commits into from
Sep 25, 2019
Merged

Bug/jon/gp update #71

merged 4 commits into from
Sep 25, 2019

Conversation

jonpvandermause
Copy link
Collaborator

Closes #70
Also makes gp.par=True the default in the otf parser, making it more efficient to reconstruct large gp models from otf output files.

@stevetorr
Copy link
Contributor

Please forgive + correct me if this is wrong: But does this not create the danger that the training set is updated, but the l_mat and alpha attributes of the GP are not updated (where alpha is later used for prediction)?

@stevetorr
Copy link
Contributor

stevetorr commented Sep 25, 2019

If my above comment is correct, an alternative would be to push the responsibility onto e.g. an OTF or GP from AIMD training process, or we could include a quick check in the predict method to see if the length of the training set is appropriate for the size of the alpha, and if not, to then call set_L_alpha (or, if it is working, update_L_alpha)

@jonpvandermause
Copy link
Collaborator Author

That would only happen if the gp object is used incorrectly. update_db is for updating the training database, set_L_alpha and update_L_alpha are for updating the covariance matrix and related vectors.

@jonpvandermause
Copy link
Collaborator Author

Right, responsibility should be on the user, it's not worth a several order of magnitude reduction in speed for training large GPs.

@jonpvandermause
Copy link
Collaborator Author

BTW, gp_from_aimd, otf, and otf_parser all call set_L_alpha immediately after update_db, so this fix also eliminates redundant calls to set_L_alpha.

@stevetorr
Copy link
Contributor

stevetorr commented Sep 25, 2019

That would only happen if the gp object is used incorrectly. update_db is for updating the training database, set_L_alpha and update_L_alpha are for updating the covariance matrix and related vectors.

I understand what the methods do on their own, I am only pointing out the risk that users who are less familiar with the code might not realize that the predict method will not immediately work as they think it will if they are working outside of OTF, GP_from_AIMD, or OTF_Parser.

Right, responsibility should be on the user, it's not worth a several order of magnitude reduction in speed for training large GPs.

To be clear, I don't disagree with the fix you made, it does make things a lot faster. I am clarifying that I'm understanding the implications for potential user confusion/unexpected behavior correctly.

Also, length calls for lists or sizes of numpy arrays are made in constant time, so adding a line to predict to double-check that alpha is the same length would add a negligible amount to the runtime compared to e.g. the get_kernel_vector method.

@codecov-io
Copy link

codecov-io commented Sep 25, 2019

Codecov Report

Merging #71 into master will increase coverage by 0.69%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #71      +/-   ##
==========================================
+ Coverage   46.95%   47.65%   +0.69%     
==========================================
  Files          37       37              
  Lines        5641     5643       +2     
==========================================
+ Hits         2649     2689      +40     
+ Misses       2992     2954      -38
Impacted Files Coverage Δ
flare/otf_parser.py 93.38% <ø> (ø) ⬆️
flare/gp.py 89.4% <50%> (+3.4%) ⬆️
flare/gp_from_aimd.py 87.71% <50%> (-0.78%) ⬇️
flare/gp_algebra.py 58.44% <0%> (+22.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0b6ba8...059ec02. Read the comment docs.

@stevetorr
Copy link
Contributor

stevetorr commented Sep 25, 2019

Feel free to axe the constant time check; either way, I approve of this PR, pull the trigger based on how you feel about the check.

@jonpvandermause jonpvandermause merged commit cc68972 into master Sep 25, 2019
@jonpvandermause jonpvandermause deleted the bug/jon/gp-update branch September 25, 2019 17:27
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.

small bug in update_db method of gp
3 participants