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

Hackathon2024 #432

Merged
merged 17 commits into from
Dec 6, 2024
Merged

Hackathon2024 #432

merged 17 commits into from
Dec 6, 2024

Conversation

djgroen
Copy link
Contributor

@djgroen djgroen commented Dec 4, 2024

Opening this pull request so that we can more easily update the branch from improvements merged into dev now.

@wedeling
Copy link
Collaborator

wedeling commented Dec 5, 2024

Changed my mind about merging the MC_sampler and the QMC_sampler. I improved the MC_sampler (now it's using Latin Hypercube sampling instead of standard MC), but the QMC_sampler still outperforms it. The QMC_sampler uses a Sobol sequence for the sampling plan, which chaospy also has. But I don't get great results when using chaospy Sobol sequence. Not sure why, but lets keep the QMC_sampler for now. Below are some convergence results for the Ishigami test function:

This is the convergence of the Sobol indices for the QMC_sampler
sobols_CI_QMC

And this is the convergence of the Sobol indices for the (improved) MC_sampler with LHS
sobols_CI_LHS

You can see it does slightly worse. I also added a MC_sampler tutorial based on David's Ishigami tutorial:

tutorials/easyvvuq_Ishigami_MC_tutorial.ipynb

The downside of the QMC_sampler is that it cannot handle discrete inputs:

import chaospy as cp
import easyvvuq as uq

params = {
"X": {"type": "integer", "min": 0, "max": 20, "default": 10},
"Y": {"type": "integer", "min": 0, "max": 30, "default": 20},
"out_file": {"type": "string", "default": "output.csv"}
}

vary = {
"X": cp.DiscreteUniform(1, 15),
"Y": cp.DiscreteUniform(5, 25)
}

sampler = uq.sampling.QMCSampler(vary, 10)

print(sampler._samples)

yields

[[ 7.99839202 12.5727271   7.99839202 12.5727271  10.91615834  4.45634572
  10.91615834  4.45634572 13.17354437 10.49896186 13.17354437 10.49896186
   1.81643268  2.79457343  1.81643268  2.79457343  3.617685    6.22252073
   3.617685    6.22252073 15.20915355 14.33661363 15.20915355 14.33661363
   9.08539457  0.79451203  9.08539457  0.79451203  5.93324277  8.50027431
   5.93324277  8.50027431  4.31672382  2.07887021  4.31672382  2.07887021
   8.88614391  9.37631389  8.88614391  9.37631389]
 [ 9.5766644   9.5766644  11.28419756 11.28419756 17.23222226 17.23222226
  19.91744724 19.91744724 14.17919871 14.17919871  9.3791574   9.3791574
  21.82246991 21.82246991 21.74555243 21.74555243 11.59565443 11.59565443
  24.00273878 24.00273878 24.24227112 24.24227112  4.9097011   4.9097011
   6.99255919  6.99255919 15.36594972 15.36594972 19.65258407 19.65258407
  13.45934261 13.45934261 13.41516756 13.41516756  6.21579362  6.21579362
  21.10977839 21.10977839 25.30882857 25.30882857]]

The MC_sampler does not have this problem. I'll add a warning to the QMC_sampler if a vary dict with discrete inputs is passed.

@DavidPCoster DavidPCoster merged commit 5624a2e into dev Dec 6, 2024
10 checks passed
@DavidPCoster DavidPCoster deleted the hackathon2024 branch December 6, 2024 14:42
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.

4 participants