-
Notifications
You must be signed in to change notification settings - Fork 17
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
Regularization & standardization #111
Conversation
mhowlan3
commented
Mar 23, 2021
- Log-posterior calculation in MCMC
- SVD regularization via truncation
- Re-normalization (standardization) of output space
full_cov = Diagonal(gvar) | ||
eigs = eigvals(full_cov) | ||
log_gpfidelity = -FT(0.5) * sum(log.(eigs)) | ||
# Combine got log_rho |
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.
In this version of MCMC, we are actually assuming that gvar
is a vector of floats, I'm thinking maybe we should relax this to take in matrices. Perhaps the easiest way is to rewrite the current mcmc_sample!
function to take in matrix input gcov
and add this extra function
function mcmc_sample!(mcmc::MCMC{FT}, g::Vector{FT}, gvar::Vector{FT}) where {FT}
return mcmc_sample!(mcmc, g, Diagonal(gvar))
end
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.
I've just checked that if eigvals receives a Diagonal
type matrix it really does just take the diagonal as the eigenvalues. and so is a nanosecond timed computation still, and so the above should still take advantage of the structure
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.
Great! I also wrote it this way in the event that full_cov
becomes a full matrix in the future, rather than just diagonal.
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.
I am not sure you have pushed this yet? I can't see it it
src/GaussianProcessEmulator.jl
Outdated
@@ -66,11 +76,13 @@ struct GaussianProcess{FT<:AbstractFloat, GPM} | |||
"the Gaussian Process (GP) Regression model(s) that are fitted to the given input-data pairs" | |||
models::Vector | |||
"the singular value decomposition of obs_noise_cov, such that obs_noise_cov = decomposition.U * Diagonal(decomposition.S) * decomposition.Vt." | |||
decomposition::Union{SVD, Nothing} | |||
decomposition::Union{SVD, decomp_struct, Nothing} |
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.
It's fine to create the decomposition structure here,
might be nice to save everything in you decomp_struct
format, then you can use Union{decomp_struct, Nothing}
as the type.
You just need to add a constructor for decomp_struct
for the non-truncated case, (something like this?)
decomp_struct(svd::SVD) = decomp_struct(svd.V, svd.Vt, svd.S, size(svd.V)[0])
and then create the structs
decomposition = decomp_struct(svd(obs_noise_cov))
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.
Thanks very much Mike!
- If you agree about the decomposition type, could you change that, should be a quick change
- Check that you wish to keep all the
println
statements in the source files, and also there are a couple of# TO DO
comments that could be removed in the source files (check the diff) - Codecov report (if you go through the testing) shows a +1.43% increase
Otherwise LGTM!
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
==========================================
- Coverage 88.98% 80.90% -8.09%
==========================================
Files 4 4
Lines 336 377 +41
==========================================
+ Hits 299 305 +6
- Misses 37 72 +35
Continue to review full report at Codecov.
|
bors r+ |
Timed out. |
bors r+ |
Build succeeded: |