From e7a64d6315b57f09603b0ce94c3ebc6e06015bf3 Mon Sep 17 00:00:00 2001 From: odunbar Date: Fri, 3 Nov 2023 13:58:31 -0700 Subject: [PATCH] typo fix compat with v1.1.4 EKP --- src/ScalarRandomFeature.jl | 2 +- src/Utilities.jl | 28 ---------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/ScalarRandomFeature.jl b/src/ScalarRandomFeature.jl index 4c2fdb22d..05a9c9987 100644 --- a/src/ScalarRandomFeature.jl +++ b/src/ScalarRandomFeature.jl @@ -394,7 +394,7 @@ function build_models!( accelerator = optimizer_options["accelerator"] initial_params = construct_initial_ensemble(rng, prior, n_ensemble) - min_complexity = log(regularization.λ) + min_complexity = n_features_opt * log(regularization.λ) min_complexity = sqrt(abs(min_complexity)) data = vcat(get_outputs(io_pairs_opt)[(n_train + 1):end], 0.0, min_complexity) ekiobj = EKP.EnsembleKalmanProcess( diff --git a/src/Utilities.jl b/src/Utilities.jl index e1a625892..ca937c1a8 100644 --- a/src/Utilities.jl +++ b/src/Utilities.jl @@ -14,7 +14,6 @@ export get_training_points export get_obs_sample export orig2zscore export zscore2orig -export posdef_correct """ $(DocStringExtensions.TYPEDSIGNATURES) @@ -120,31 +119,4 @@ function zscore2orig(Z::AbstractMatrix{FT}, mean::AbstractVector{FT}, std::Abstr return X end - -""" -$(DocStringExtensions.TYPEDSIGNATURES) - -Makes square matrix `mat` positive definite, by symmetrizing and bounding the minimum eigenvalue below by `tol` -""" -function posdef_correct(mat::AbstractMatrix; tol::Real = 1e8 * eps()) - if !issymmetric(mat) - out = 0.5 * (mat + permutedims(mat, (2, 1))) #symmetrize - if isposdef(out) - # very often, small numerical errors cause asymmetry, so cheaper to add this branch - return out - end - else - out = mat - end - - nugget = abs(minimum(eigvals(out))) - for i in 1:size(out, 1) - out[i, i] += nugget + tol #add to diag - end - return out -end - - - - end # module