Optimize ensemble when Gram-Schmidt is not requested
This commit is contained in:
parent
3b2277cbd0
commit
37fa83a4e2
15
EC.jl
15
EC.jl
|
|
@ -58,10 +58,17 @@ function train!(EC::affine_EC, c_vals; ref_eval=-10.0, CAEC=false, gram_schmidt_
|
||||||
(EC.H0_EC, EC.H1_EC, EC.N_EC) = get_reduced_matrices(EC, training_vecs, gram_schmidt_threshold; verbose=true)
|
(EC.H0_EC, EC.H1_EC, EC.N_EC) = get_reduced_matrices(EC, training_vecs, gram_schmidt_threshold; verbose=true)
|
||||||
|
|
||||||
for _ in 1:EC.ensemble_size
|
for _ in 1:EC.ensemble_size
|
||||||
(H0_EC, H1_EC, N_EC) = get_reduced_matrices(EC, training_vecs, gram_schmidt_threshold, resample(length(training_vecs)); verbose=false)
|
subsample = resample(length(training_vecs))
|
||||||
push!(EC.H0_EC_ensemble, H0_EC)
|
if gram_schmidt_threshold > 0
|
||||||
push!(EC.H1_EC_ensemble, H1_EC)
|
(H0_EC, H1_EC, N_EC) = get_reduced_matrices(EC, training_vecs, gram_schmidt_threshold, subsample; verbose=false)
|
||||||
push!(EC.N_EC_ensemble, N_EC)
|
push!(EC.H0_EC_ensemble, H0_EC)
|
||||||
|
push!(EC.H1_EC_ensemble, H1_EC)
|
||||||
|
push!(EC.N_EC_ensemble, N_EC)
|
||||||
|
else
|
||||||
|
push!(EC.H0_EC_ensemble, EC.H0_EC[subsample, subsample])
|
||||||
|
push!(EC.H1_EC_ensemble, EC.H1_EC[subsample, subsample])
|
||||||
|
push!(EC.N_EC_ensemble, EC.N_EC[subsample, subsample])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
EC.trained = true
|
EC.trained = true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue