hdgpso 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hdgpso/__init__.py +64 -0
- hdgpso/_version.py +2 -0
- hdgpso/core.py +676 -0
- hdgpso/multifidelity.py +315 -0
- hdgpso/plots.py +166 -0
- hdgpso/stats.py +419 -0
- hdgpso-0.1.0.dist-info/METADATA +234 -0
- hdgpso-0.1.0.dist-info/RECORD +10 -0
- hdgpso-0.1.0.dist-info/WHEEL +4 -0
- hdgpso-0.1.0.dist-info/licenses/LICENSE +21 -0
hdgpso/__init__.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""hdgpso package. Hybrid DE-GWO-PSO hyperparameter optimization.
|
|
2
|
+
|
|
3
|
+
The :class:`HDGPSO` class is the optimizer described in the paper. It
|
|
4
|
+
runs three operator stages on the same population in every iteration:
|
|
5
|
+
Differential Evolution, Grey Wolf Optimization, and Particle Swarm
|
|
6
|
+
Optimization. A RandomForest surrogate is fit on the trial history
|
|
7
|
+
and is used to filter proposed candidates between the stages, using a
|
|
8
|
+
tree-variance lower-confidence-bound score.
|
|
9
|
+
|
|
10
|
+
Quick start::
|
|
11
|
+
|
|
12
|
+
from hdgpso import HDGPSO, SearchSpace, Float, Int, Categorical
|
|
13
|
+
|
|
14
|
+
space = SearchSpace({
|
|
15
|
+
"lr": Float(1e-5, 1e-2, log=True),
|
|
16
|
+
"layers": Int(2, 8),
|
|
17
|
+
"act": Categorical(["relu", "gelu", "tanh"]),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
def objective(params):
|
|
21
|
+
# train a model with the given hyperparameters
|
|
22
|
+
return -val_accuracy # lower is better
|
|
23
|
+
|
|
24
|
+
result = HDGPSO(space, objective, population_size=10,
|
|
25
|
+
iterations=15, seed=0).optimize()
|
|
26
|
+
print(result.best_params, result.best_loss)
|
|
27
|
+
|
|
28
|
+
The rank-based statistical helpers used for the paper benchmark
|
|
29
|
+
(Friedman, Nemenyi, CD diagrams, Cliff's delta, bootstrap confidence
|
|
30
|
+
intervals) are available in :mod:`hdgpso.stats`.
|
|
31
|
+
|
|
32
|
+
.. note::
|
|
33
|
+
|
|
34
|
+
:class:`HDGPSOMF` is an experimental multi-fidelity variant built on
|
|
35
|
+
top of HDGPSO with BOHB-style successive halving. It is included for
|
|
36
|
+
future-work exploration only. It is not part of the published
|
|
37
|
+
results, and its API is not yet stable.
|
|
38
|
+
"""
|
|
39
|
+
from .core import (
|
|
40
|
+
Categorical,
|
|
41
|
+
Dimension,
|
|
42
|
+
Float,
|
|
43
|
+
HDGPSO,
|
|
44
|
+
Int,
|
|
45
|
+
OptimizeResult,
|
|
46
|
+
SearchSpace,
|
|
47
|
+
)
|
|
48
|
+
from .multifidelity import HDGPSOMF
|
|
49
|
+
from ._version import __version__
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
# Search space
|
|
53
|
+
"Categorical",
|
|
54
|
+
"Dimension",
|
|
55
|
+
"Float",
|
|
56
|
+
"Int",
|
|
57
|
+
"SearchSpace",
|
|
58
|
+
# Optimizers
|
|
59
|
+
"HDGPSO",
|
|
60
|
+
"HDGPSOMF",
|
|
61
|
+
"OptimizeResult",
|
|
62
|
+
# Version
|
|
63
|
+
"__version__",
|
|
64
|
+
]
|
hdgpso/_version.py
ADDED