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

Add QMC sampler #2423

Merged
merged 83 commits into from Jan 27, 2022
Merged

Add QMC sampler #2423

merged 83 commits into from Jan 27, 2022

Conversation

kstoneriv3
Copy link
Contributor

@kstoneriv3 kstoneriv3 commented Feb 28, 2021

Motivation

As in #1797, Quasi-Monte Carlo (QMC) sampler should be supported as a good alternative to RandomSampler. I want to discuss the implementational details of the QMCSampler as there exist several design choices for ensuring that it works in a distributed environment.

Description of the changes

QMCSampler is added at optuna/sampler/_qmc.py. Since scipy will introduce support of QMC in the 1.7.0 release, we use their implementation of QMC to generate several kinds of QMC sequences.

Design Choices around Distributed Environment

To suggest QMC samples using distributed workers, we have to synchronize them. This is because QMC sequences are strictly ordered. They cannot be sampled independently; each worker must know exactly how many QMC samples were suggested so far. Since the storage of Optuna does not support atomic transactions, (as far as I understood) we have to compromise somewhere and thus there are some design choices. The possible design I considered are as follows:

  • (Current PR) Use the system attributes of the study to count how many QMC samples have been suggested so far. The advantage of this implementation is that it is simple.
  • In the system attributes of each trial, store the which sample of QMC sample (qmc_id) it is. Then, every time we suggest a new sample, we check all past trials to see how many QMC points have been suggested so far. (Above strategy should be faster than this because they access O(1) information while this access O(n_trials) information in each trial.
  • Set Trial._trial_id or Trial.number equal to qmc_id + const. (This fails when there are different types of samplers running simultaneously.)
  • Set the maximum number of samples of QMC and sample all points at the construction of QMCSampler. In each trial, we randomly pick a point that is not yet sampled from a pool of the pre-sampled points. This strategy is the same as the GridSampler. (This can be inefficient if we fail to sample early points of QMC sequences as the earlier points of the QMC sequences are more important than their later parts. So, it seems better to sample QMC in the ordered manner. )

TODO:

  • Discuss design choices based on current design
  • Add docstring
  • Add test code
  • Remove unnecessary comments

@github-actions github-actions bot added the optuna.samplers Related to the `optuna.samplers` submodule. This is automatically labeled by github-actions. label Feb 28, 2021
@kstoneriv3 kstoneriv3 changed the title Quasi-Monte Carlo Sampler Add quasi Monte Carlo sampler Feb 28, 2021
@kstoneriv3 kstoneriv3 changed the title Add quasi Monte Carlo sampler Add QMCSampler Feb 28, 2021
@kstoneriv3 kstoneriv3 changed the title Add QMCSampler Add QMC sampler Feb 28, 2021
@codecov-io
Copy link

codecov-io commented Feb 28, 2021

Codecov Report

Merging #2423 (bafae2b) into master (d96a21f) will decrease coverage by 0.49%.
The diff coverage is 31.86%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2423      +/-   ##
==========================================
- Coverage   91.46%   90.97%   -0.50%     
==========================================
  Files         134      135       +1     
  Lines       11277    11368      +91     
==========================================
+ Hits        10315    10342      +27     
- Misses        962     1026      +64     
Impacted Files Coverage Δ
optuna/samplers/_qmc.py 31.11% <31.11%> (ø)
optuna/samplers/__init__.py 100.00% <100.00%> (ø)
optuna/integration/botorch.py 97.76% <0.00%> (-0.90%) ⬇️
optuna/storages/_cached_storage.py 97.06% <0.00%> (ø)

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 d96a21f...d63fab9. Read the comment docs.

@HideakiImamura HideakiImamura added the feature Change that does not break compatibility, but affects the public interfaces. label Mar 2, 2021
@HideakiImamura
Copy link
Member

@hvy Could you review this PR?

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great PR. I'm excited to introduce this feature into Optuna. I have some early comments. Could you take a look?

IMO, the current design is fine. Looks reasonable as you explained.

optuna/samplers/_qmc.py Outdated Show resolved Hide resolved
optuna/samplers/_qmc.py Outdated Show resolved Hide resolved
optuna/samplers/_qmc.py Show resolved Hide resolved
optuna/samplers/_qmc.py Outdated Show resolved Hide resolved
optuna/samplers/_qmc.py Outdated Show resolved Hide resolved
optuna/samplers/_qmc.py Outdated Show resolved Hide resolved
@HideakiImamura
Copy link
Member

And, could you merge the master branch to pass the CI?

Copy link
Member

@himkt himkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 2 3 4
hpo-bench-naval-8a1cfca70207d8f788756eb020787bdae5eda54db2b55f4e99e06fd3b2c37501 hpo-bench-parkinson-1342958b65feb590e4c0284f73a7373aa1006595f85f3ce9a4645ea1bfa581d6 hpo-bench-protein-1b4174b8176983b02dd2f15d046224b7711a434a5cdcbaa21ee312a518d9e16f hpo-bench-slice-5f2477ceae0c4ef5f4c2559346629b167d8768929dd754173010cdbcfe505631

I also verified QMCSampler nicely works. Looks good with the trivial suggestion.

optuna/samplers/_qmc.py Outdated Show resolved Hide resolved
optuna/samplers/_qmc.py Show resolved Hide resolved
@tupui
Copy link
Contributor

tupui commented Jan 25, 2022

I also verified QMCSampler nicely works. Looks good with the trivial suggestion.

Nice 👍 was this with Halton scrambled?

@himkt
Copy link
Member

himkt commented Jan 25, 2022

I used the default parameter (Halton without scrambled) in the above experiment. I retried the benchmark with/without scramble parameter. Magenta refers to QMC (halton, without scramble) and green refers to QCM (halton, with scramble). 👀 💭

1 2 3 4
hpo-bench-naval-8a1cfca70207d8f788756eb020787bdae5eda54db2b55f4e99e06fd3b2c37501 hpo-bench-parkinson-1342958b65feb590e4c0284f73a7373aa1006595f85f3ce9a4645ea1bfa581d6 hpo-bench-protein-1b4174b8176983b02dd2f15d046224b7711a434a5cdcbaa21ee312a518d9e16f hpo-bench-slice-5f2477ceae0c4ef5f4c2559346629b167d8768929dd754173010cdbcfe505631

(1) Problem: HPO-Bench-Parkinson

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 #id-A 0.008093 +- 0.001968 1.835 +- 0.627 7.822 +- 0.404
2 #id-B 0.013459 +- 0.004249 2.278 +- 0.707 2.454 +- 0.298
2 #id-C 0.016326 +- 0.005536 2.447 +- 0.809 0.703 +- 0.114
2 #id-D 0.014313 +- 0.004517 2.258 +- 0.699 3.807 +- 0.298

(2) Problem: HPO-Bench-Protein

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 #id-A 0.221682 +- 0.001571 19.766 +- 0.796 7.761 +- 0.539
2 #id-B 0.250339 +- 0.015279 21.606 +- 1.066 2.480 +- 0.661
2 #id-C 0.257469 +- 0.016689 22.113 +- 0.972 0.690 +- 0.113
2 #id-D 0.256198 +- 0.015285 21.863 +- 1.358 3.728 +- 0.312

(3) Problem: HPO-Bench-Slice

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 #id-A 0.000215 +- 0.000037 0.225 +- 0.322 7.900 +- 0.498
2 #id-B 0.000400 +- 0.000135 0.172 +- 0.239 2.624 +- 1.000
2 #id-C 0.000501 +- 0.000205 0.252 +- 0.326 0.697 +- 0.131
2 #id-D 0.000435 +- 0.000167 0.203 +- 0.251 3.840 +- 0.257

(5) Problem: HPO-Bench-Naval

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 #id-A 0.000032 +- 0.000005 0.675 +- 0.987 7.849 +- 0.598
2 #id-B 0.000160 +- 0.000133 0.339 +- 0.420 2.532 +- 0.279
2 #id-C 0.000199 +- 0.000258 0.704 +- 0.976 0.732 +- 0.165
2 #id-D 0.000180 +- 0.000139 0.546 +- 0.605 3.980 +- 0.314

Solvers

ID: A

recipe:

{
  "name": "_TPESampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "TPESampler",
    "sampler_kwargs": "{\"multivariate\":true,\"constant_liar\":true}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

ID: B

recipe:

{
  "name": "_QMCSampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "QMCSampler",
    "sampler_kwargs": "{}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

ID: C

recipe:

{
  "name": "_RandomSampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "RandomSampler",
    "sampler_kwargs": "{}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

ID: D

recipe:

{
  "name": "_QMCSampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "QMCSampler",
    "sampler_kwargs": "{\"scramble\":true}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

Co-authored-by: himkt <himkt@klis.tsukuba.ac.jp>
@tupui
Copy link
Contributor

tupui commented Jan 25, 2022

@himkt thanks for the details. I am a bit surprised that Halton is not performing better than a pure random sampler. TPE's results make sense as it takes into account the output, but for random it should not be the case. Or it might just be luck here or the class of problem which does not depend much on the quality of the sampler.

@kstoneriv3
Copy link
Contributor Author

@himkt Thank you so much for the quick reviews and for taking the benchmark!!

@himkt
Copy link
Member

himkt commented Jan 25, 2022

@tupui

I am a bit surprised that Halton is not performing better than a pure random sampler.

I thought that the experiment showed that QMC sampler performed better than Random sampler. 👀
(Sorry I may misunderstand something, I thought that based on the best MSEs)

If you're interested in benchmarking on your own, you can do it on GitHub Actions.
(You have to fork Optuna and push this feature branch to your forked repo)

More details are described here:
https://github.com/optuna/optuna/tree/master/benchmarks#performance-benchmarks-with-kurobako

@tupui
Copy link
Contributor

tupui commented Jan 25, 2022

I thought that the experiment showed that QMC sampler performed better than Random sampler. 👀 (Sorry I may misunderstand something, I thought that based on the best MSEs)

I expected a clearer separation between Random and QMC.

If you're interested in benchmarking on your own, you can do it on GitHub Actions. (You have to fork Optuna and push this feature branch to your forked repo)

More details are described here: master/benchmarks#performance-benchmarks-with-kurobako

Thanks.

optuna/samplers/_qmc.py Show resolved Hide resolved
optuna/samplers/_qmc.py Show resolved Hide resolved
@kstoneriv3
Copy link
Contributor Author

kstoneriv3 commented Jan 25, 2022

@himkt @tupui @HideakiImamura The benchmark results do not quite agree with the results I got in #1797, so I took the benchmark on my own and got the same results as @himkt . The performance of QMCSampler is much better in #1797. Additionally, there are some points that made me feel that the implementation might have some room for improvement:

  • Scrambling seems to decay the performance of QMC sequence, which should not be the case IMO.
  • Sobol' performed much better than Halton in my experiment, which implies that we might need to switch the default qmc_type to "sobol", even though it does not have good performance guarantees when the total number of samples is not the power of 2.

So I would like to take time to investigate if there is any issue with the current implementation before this PR is merged.

@kstoneriv3
Copy link
Contributor Author

Benchmark results:

click here for benchmark results

Benchmark Result Report

  • Kurobako Version: 0.2.9
  • Number of Solvers: 7
  • Number of Problems: 4
  • Metrics Precedence: best value -> AUC

Please refer to "A Strategy for Ranking Optimizers using Multiple Criteria" for the ranking strategy used in this report.

Table of Contents

  1. Overall Results
  2. Individual Results
  3. Solvers
  4. Problems
  5. Studies

Overall Results

Solver Borda Firsts
_HaltonSampler_NopPruner 0 0
_HaltonSampler_Scrambled_NopPruner 0 0
_RandomSampler_NopPruner 0 0
_SobolSampler_NopPruner 11 0
_SobolSampler_Scrambled_NopPruner 0 0
_TPESampler_NopPruner 24 4
_UnivariateTPESampler_NopPruner 20 0

Individual Results

(1) Problem: HPO-Bench-Naval

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 _TPESampler_NopPruner (study) 0.000033 +- 0.000007 0.760 +- 0.985 2.205 +- 0.114
2 _UnivariateTPESampler_NopPruner (study) 0.000066 +- 0.000079 0.904 +- 1.194 2.746 +- 0.125
3 _SobolSampler_NopPruner (study) 0.000094 +- 0.000063 0.495 +- 0.539 0.231 +- 0.023
3 _RandomSampler_NopPruner (study) 0.000143 +- 0.000168 0.789 +- 1.139 0.210 +- 0.017
4 _HaltonSampler_NopPruner (study) 0.000147 +- 0.000092 0.606 +- 1.318 0.562 +- 0.041
4 _HaltonSampler_Scrambled_NopPruner (study) 0.000124 +- 0.000075 0.831 +- 0.929 0.964 +- 0.066
4 _SobolSampler_Scrambled_NopPruner (study) 0.000114 +- 0.000056 0.718 +- 0.749 0.303 +- 0.021

(2) Problem: HPO-Bench-Protein

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 _TPESampler_NopPruner (study) 0.221766 +- 0.002020 24.192 +- 0.827 2.190 +- 0.129
2 _UnivariateTPESampler_NopPruner (study) 0.230433 +- 0.010705 25.225 +- 1.552 2.760 +- 0.137
3 _SobolSampler_NopPruner (study) 0.252599 +- 0.013238 26.500 +- 1.742 0.230 +- 0.022
3 _HaltonSampler_NopPruner (study) 0.251324 +- 0.013957 26.776 +- 1.368 0.563 +- 0.047
3 _RandomSampler_NopPruner (study) 0.252237 +- 0.014085 26.829 +- 1.477 0.208 +- 0.015
3 _HaltonSampler_Scrambled_NopPruner (study) 0.250963 +- 0.013008 26.655 +- 1.354 0.962 +- 0.076
3 _SobolSampler_Scrambled_NopPruner (study) 0.251389 +- 0.014147 26.791 +- 1.488 0.306 +- 0.036

(3) Problem: HPO-Bench-Slice

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 _TPESampler_NopPruner (study) 0.000198 +- 0.000032 14.856 +- 143.325 2.192 +- 0.121
2 _UnivariateTPESampler_NopPruner (study) 0.000277 +- 0.000085 18769.553 +- 186748.290 2.761 +- 0.137
3 _SobolSampler_NopPruner (study) 0.000383 +- 0.000093 8.780 +- 75.781 0.231 +- 0.019
4 _HaltonSampler_NopPruner (study) 0.000409 +- 0.000117 1.650 +- 10.672 0.557 +- 0.042
4 _RandomSampler_NopPruner (study) 0.000455 +- 0.000170 0.530 +- 0.747 0.210 +- 0.017
4 _HaltonSampler_Scrambled_NopPruner (study) 0.000437 +- 0.000153 63.227 +- 621.594 0.966 +- 0.072
4 _SobolSampler_Scrambled_NopPruner (study) 0.000423 +- 0.000127 0.718 +- 2.115 0.302 +- 0.025

(4) Problem: HPO-Bench-Parkinson

Ranking Solver Best (avg +- sd) AUC (avg +- sd) Elapsed (avg +- sd)
1 _TPESampler_NopPruner (study) 0.007426 +- 0.001748 2.084 +- 1.263 2.208 +- 0.105
2 _UnivariateTPESampler_NopPruner (study) 0.009209 +- 0.003110 2.669 +- 2.342 2.778 +- 0.138
3 _SobolSampler_NopPruner (study) 0.011931 +- 0.003441 3.359 +- 10.556 0.229 +- 0.026
4 _HaltonSampler_NopPruner (study) 0.013470 +- 0.003542 3.112 +- 3.602 0.565 +- 0.046
4 _RandomSampler_NopPruner (study) 0.014663 +- 0.003828 2.828 +- 1.368 0.210 +- 0.018
4 _HaltonSampler_Scrambled_NopPruner (study) 0.014615 +- 0.004137 2.664 +- 0.737 0.970 +- 0.069
4 _SobolSampler_Scrambled_NopPruner (study) 0.014147 +- 0.003558 3.647 +- 5.958 0.306 +- 0.035

Solvers

ID: a0a8ebdb9195ab1a4a61a89a0e638d5531cbd42efff393357fb2876a67c0d4a9

recipe:

{
  "name": "_HaltonSampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "QMCSampler",
    "sampler_kwargs": "{}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_HaltonSampler_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

ID: aaf9fdc7071a2414a4fd00be14adac59ea045675a2f51a90a7a9e24598660880

recipe:

{
  "name": "_HaltonSampler_Scrambled_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "QMCSampler",
    "sampler_kwargs": "{\"scramble\":true}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_HaltonSampler_Scrambled_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

ID: a6cf01ef67fb72912cc9949362e3eb221eb6d9aebd9c3fbf0b1795e1d86ff4ac

recipe:

{
  "name": "_RandomSampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "RandomSampler",
    "sampler_kwargs": "{}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_RandomSampler_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

ID: 784b72151fc1cb2abcc1e10ac3850a367016c94c7235b7dc7d00dfda3657ab70

recipe:

{
  "name": "_SobolSampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "QMCSampler",
    "sampler_kwargs": "{\"qmc_type\":\"sobol\"}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_SobolSampler_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

ID: c91be229b42e50d37a0f711c038496f61e47ef3af2cf0216b0647475b6c7ac46

recipe:

{
  "name": "_SobolSampler_Scrambled_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "QMCSampler",
    "sampler_kwargs": "{\"scramble\":true,\"qmc_type\":\"sobol\"}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_SobolSampler_Scrambled_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

ID: 3371bdcd6d1fc903733bc5d034ce94193d1e781126837c1067593e573ae6a246

recipe:

{
  "name": "_TPESampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "TPESampler",
    "sampler_kwargs": "{\"multivariate\":true,\"constant_liar\":true}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_TPESampler_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

ID: 9036c1b3f7c0515da7c7c40331769664179e82d27fc497759034938ffa244075

recipe:

{
  "name": "_UnivariateTPESampler_NopPruner",
  "optuna": {
    "loglevel": "debug",
    "sampler": "TPESampler",
    "sampler_kwargs": "{}",
    "pruner": "NopPruner",
    "pruner_kwargs": "{}"
  }
}

specification:

{
  "name": "_UnivariateTPESampler_NopPruner",
  "attrs": {
    "github": "https://github.com/optuna/optuna",
    "paper": "Akiba, Takuya, et al. \"Optuna: A next-generation hyperparameter optimization framework.\" Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.",
    "version": "optuna=2.9.0.dev0, kurobako-py=0.1.12"
  },
  "capabilities": [
    "UNIFORM_CONTINUOUS",
    "UNIFORM_DISCRETE",
    "LOG_UNIFORM_CONTINUOUS",
    "LOG_UNIFORM_DISCRETE",
    "CATEGORICAL",
    "CONDITIONAL",
    "MULTI_OBJECTIVE",
    "CONCURRENT"
  ]
}

@tupui
Copy link
Contributor

tupui commented Jan 25, 2022

Benchmark results:

click here for benchmark results

Thanks @kstoneriv3. It's indeed strange for scrambling. For Sobol' as default, if in practice it does help, fine on my side since we have the note (should be a warning maybe if Sobol' became the default) in the doc.

For merging, if I may, if the user facing API and functionalities are there, I would proceed and tackle the rest in another PR. It's already a large PR with lot of comments so it's hard to keep up. (Like I would also want to be more flexible on the sampler choice. It could allow an instance of scipy.stats.qmc.QMCEngine in case people want to use scipy.stats.qmc.LatinHypercube or something of their own).

@kstoneriv3
Copy link
Contributor Author

@tupui Thank you for the reply!

For merging, if I may, if the user facing API and functionalities are there, I would proceed and tackle the rest in another PR. It's already a large PR with lot of comments so it's hard to keep up. (Like I would also want to be more flexible on the sampler choice. It could allow an instance of scipy.stats.qmc.QMCEngine in case people want to use scipy.stats.qmc.LatinHypercube or something of their own).

I believe LatinHypercubeSampler should be implemented independently from QMCSampler for the two following reasons:

  • LatinHypercube requires that we specify the number of total samples before initializing the sampler, which can be quite tricky with the current API of QMCSampler
  • When people say QMC, it does not usually include Latin hypercube. Latin hypercube seems to appear more often under the umbrella of experimental design.

@tupui
Copy link
Contributor

tupui commented Jan 25, 2022

I believe LatinHypercubeSampler should be implemented independently from QMCSampler for the two following reasons:

  • LatinHypercube requires that we specify the number of total samples before initializing the sampler, which can be quite tricky with the current API of QMCSampler
  • When people say QMC, it does not usually include Latin hypercube. Latin hypercube seems to appear more often under the umbrella of experimental design.

Yes it's less practical for that, although similar to Sobol' if you are strict (need to know n). The second point is very debatable 😉 We do see LHS discussions/papers in the QMC community (framed under the term orthogonal array).

@himkt
Copy link
Member

himkt commented Jan 25, 2022

Thank you @tupui for the insight! and sorry for my lack of algorithmic knowledge.

@kstoneriv3 Thank you for your continuous effort.

there is any issue with the current implementation before this PR is merged

I think the basic interface looks solid so it is reasonable to me.
As @tupui suggested, this PR already becomes large so it's good to consider dividing another tasks.
I'd like to hear the opinion by @HideakiImamura @keisuke-umezawa.

@kstoneriv3
Copy link
Contributor Author

kstoneriv3 commented Jan 25, 2022

@tupui @himkt OK, I changed the default qmc_type to "sobol" but I will not make any other change to this PR.

As for the difference in the benchmark results, I found that it comes from calling samplers from the CUI argument and from the python script (For details, see https://gist.github.com/kstoneriv3/496f8b2fa864193e538fe644202eca66). I will create a issue about this at optuna/kurobako-py#15.

@himkt
Copy link
Member

himkt commented Jan 26, 2022

Please take a look @HideakiImamura. 👍

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the long running PR @kstoneriv3, and thanks for the careful reviews @tupui @keisuke-umezawa @himkt. LGTM.

@HideakiImamura HideakiImamura merged commit 1bd4be1 into optuna:master Jan 27, 2022
@HideakiImamura HideakiImamura added this to the v3.0.0-a1 milestone Jan 27, 2022
@himkt
Copy link
Member

himkt commented Jan 28, 2022

Hi @kstoneriv3, let me say again thank you so much for the great contribution!
For further direction, would you mind creating a tracking issue for improving QMCSampler?
I think it'd be good to cover the points described in #2423 (comment).

@kstoneriv3
Copy link
Contributor Author

Hi @kstoneriv3, let me say again thank you so much for the great contribution! For further direction, would you mind creating a tracking issue for improving QMCSampler? I think it'd be good to cover the points described in #2423 (comment).

Sorry for the late reply! I summarized these points in #2625.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Change that does not break compatibility, but affects the public interfaces. no-stale Exempt from stale bot optuna.samplers Related to the `optuna.samplers` submodule. This is automatically labeled by github-actions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants