|
4 | 4 | Examples |
5 | 5 | ======== |
6 | 6 |
|
7 | | -This page provides a collection of examples demonstrating Hyperactive's capabilities. |
| 7 | +This section provides a collection of examples demonstrating Hyperactive's capabilities. |
8 | 8 | All examples are available in the |
9 | 9 | `examples directory <https://github.com/SimonBlanke/Hyperactive/tree/master/examples>`_ |
10 | 10 | on GitHub. |
11 | 11 |
|
| 12 | +.. toctree:: |
| 13 | + :maxdepth: 1 |
12 | 14 |
|
13 | | -Example Gallery |
14 | | ---------------- |
| 15 | + examples/general |
| 16 | + examples/local_search |
| 17 | + examples/global_search |
| 18 | + examples/population_based |
| 19 | + examples/sequential_model_based |
| 20 | + examples/optuna_backend |
| 21 | + examples/sklearn_backend |
| 22 | + examples/integrations |
| 23 | + examples/other |
| 24 | + examples/interactive_tutorial |
15 | 25 |
|
16 | | -Hyperactive includes examples for various optimization algorithms and use cases. |
17 | | -You can run any example directly: |
18 | 26 |
|
19 | | -.. code-block:: bash |
| 27 | +Overview |
| 28 | +-------- |
20 | 29 |
|
21 | | - # Clone the repository |
22 | | - git clone https://github.com/SimonBlanke/Hyperactive.git |
23 | | - cd Hyperactive/examples |
| 30 | +Hyperactive provides examples for all optimization algorithms and integration |
| 31 | +patterns. The examples are organized by algorithm category: |
24 | 32 |
|
25 | | - # Run an example |
26 | | - python gfo/hill_climbing_example.py |
27 | 33 |
|
| 34 | +Gradient-Free Optimizers (GFO) |
| 35 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
28 | 36 |
|
29 | | -Basic Examples |
30 | | --------------- |
| 37 | +:ref:`examples_general` |
| 38 | + Basic examples showing custom function optimization and sklearn model tuning. |
31 | 39 |
|
32 | | -Custom Function Optimization |
33 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 40 | +:ref:`examples_local_search` |
| 41 | + Hill Climbing, Simulated Annealing, Downhill Simplex, and other local |
| 42 | + search methods that explore by making incremental moves. |
34 | 43 |
|
35 | | -The simplest use case: optimizing a mathematical function. |
| 44 | +:ref:`examples_global_search` |
| 45 | + Random Search, Grid Search, Powell's Method, and other algorithms that |
| 46 | + explore the search space more broadly. |
36 | 47 |
|
37 | | -.. literalinclude:: _snippets/examples/basic_examples.py |
38 | | - :language: python |
39 | | - :start-after: # [start:custom_function] |
40 | | - :end-before: # [end:custom_function] |
| 48 | +:ref:`examples_population_based` |
| 49 | + Particle Swarm, Genetic Algorithm, Evolution Strategy, and other |
| 50 | + nature-inspired population methods. |
41 | 51 |
|
| 52 | +:ref:`examples_sequential_model_based` |
| 53 | + Bayesian Optimization, Tree-Parzen Estimators, and other model-based |
| 54 | + methods that learn from previous evaluations. |
42 | 55 |
|
43 | | -Scikit-learn Model Tuning |
44 | | -^^^^^^^^^^^^^^^^^^^^^^^^^ |
45 | 56 |
|
46 | | -Hyperparameter optimization for machine learning models. |
| 57 | +Backend Examples |
| 58 | +^^^^^^^^^^^^^^^^ |
47 | 59 |
|
48 | | -.. literalinclude:: _snippets/examples/basic_examples.py |
49 | | - :language: python |
50 | | - :start-after: # [start:sklearn_tuning] |
51 | | - :end-before: # [end:sklearn_tuning] |
| 60 | +:ref:`examples_optuna_backend` |
| 61 | + Examples using Optuna's samplers including TPE, CMA-ES, NSGA-II/III, |
| 62 | + and Gaussian Process optimization. |
52 | 63 |
|
53 | | - |
54 | | -Gradient-Free Optimizer Examples |
55 | | --------------------------------- |
56 | | - |
57 | | -Local Search Algorithms |
58 | | -^^^^^^^^^^^^^^^^^^^^^^^ |
59 | | - |
60 | | -.. list-table:: |
61 | | - :header-rows: 1 |
62 | | - :widths: 30 70 |
63 | | - |
64 | | - * - Algorithm |
65 | | - - Example |
66 | | - * - Hill Climbing |
67 | | - - `hill_climbing_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/hill_climbing_example.py>`_ |
68 | | - * - Repulsing Hill Climbing |
69 | | - - `repulsing_hill_climbing_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/repulsing_hill_climbing_example.py>`_ |
70 | | - * - Simulated Annealing |
71 | | - - `simulated_annealing_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/simulated_annealing_example.py>`_ |
72 | | - * - Downhill Simplex |
73 | | - - `downhill_simplex_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/downhill_simplex_example.py>`_ |
74 | | - |
75 | | - |
76 | | -Global Search Algorithms |
77 | | -^^^^^^^^^^^^^^^^^^^^^^^^ |
78 | | - |
79 | | -.. list-table:: |
80 | | - :header-rows: 1 |
81 | | - :widths: 30 70 |
82 | | - |
83 | | - * - Algorithm |
84 | | - - Example |
85 | | - * - Random Search |
86 | | - - `random_search_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/random_search_example.py>`_ |
87 | | - * - Grid Search |
88 | | - - `grid_search_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/grid_search_example.py>`_ |
89 | | - * - Random Restart Hill Climbing |
90 | | - - `random_restart_hill_climbing_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/random_restart_hill_climbing_example.py>`_ |
91 | | - * - Stochastic Hill Climbing |
92 | | - - `stochastic_hill_climbing_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/stochastic_hill_climbing_example.py>`_ |
93 | | - * - Powell's Method |
94 | | - - `powells_method_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/powells_method_example.py>`_ |
95 | | - * - Pattern Search |
96 | | - - `pattern_search_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/pattern_search_example.py>`_ |
97 | | - |
98 | | - |
99 | | -Population-Based Algorithms |
100 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
101 | | - |
102 | | -.. list-table:: |
103 | | - :header-rows: 1 |
104 | | - :widths: 30 70 |
105 | | - |
106 | | - * - Algorithm |
107 | | - - Example |
108 | | - * - Particle Swarm |
109 | | - - `particle_swarm_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/particle_swarm_example.py>`_ |
110 | | - * - Genetic Algorithm |
111 | | - - `genetic_algorithm_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/genetic_algorithm_example.py>`_ |
112 | | - * - Evolution Strategy |
113 | | - - `evolution_strategy_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/evolution_strategy_example.py>`_ |
114 | | - * - Differential Evolution |
115 | | - - `differential_evolution_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/differential_evolution_example.py>`_ |
116 | | - * - Parallel Tempering |
117 | | - - `parallel_tempering_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/parallel_tempering_example.py>`_ |
118 | | - * - Spiral Optimization |
119 | | - - `spiral_optimization_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/spiral_optimization_example.py>`_ |
120 | | - |
121 | | - |
122 | | -Sequential Model-Based Algorithms |
123 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
124 | | - |
125 | | -.. list-table:: |
126 | | - :header-rows: 1 |
127 | | - :widths: 30 70 |
128 | | - |
129 | | - * - Algorithm |
130 | | - - Example |
131 | | - * - Bayesian Optimization |
132 | | - - `bayesian_optimization_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/bayesian_optimization_example.py>`_ |
133 | | - * - Tree-Parzen Estimators |
134 | | - - `tree_structured_parzen_estimators_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/tree_structured_parzen_estimators_example.py>`_ |
135 | | - * - Forest Optimizer |
136 | | - - `forest_optimizer_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/forest_optimizer_example.py>`_ |
137 | | - * - Lipschitz Optimizer |
138 | | - - `lipschitz_optimizer_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/lipschitz_optimizer_example.py>`_ |
139 | | - * - DIRECT Algorithm |
140 | | - - `direct_algorithm_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/gfo/direct_algorithm_example.py>`_ |
141 | | - |
142 | | - |
143 | | -Optuna Backend Examples |
144 | | ------------------------ |
145 | | - |
146 | | -Examples using Optuna's optimization algorithms: |
147 | | - |
148 | | -.. list-table:: |
149 | | - :header-rows: 1 |
150 | | - :widths: 30 70 |
151 | | - |
152 | | - * - Algorithm |
153 | | - - Example |
154 | | - * - TPE Optimizer |
155 | | - - `tpe_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/tpe_sampler_example.py>`_ |
156 | | - * - CMA-ES |
157 | | - - `cmaes_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/cmaes_sampler_example.py>`_ |
158 | | - * - Gaussian Process |
159 | | - - `gp_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/gp_sampler_example.py>`_ |
160 | | - * - NSGA-II |
161 | | - - `nsga_ii_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/nsga_ii_sampler_example.py>`_ |
162 | | - * - NSGA-III |
163 | | - - `nsga_iii_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/nsga_iii_sampler_example.py>`_ |
164 | | - * - QMC |
165 | | - - `qmc_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/qmc_sampler_example.py>`_ |
166 | | - * - Random |
167 | | - - `random_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/random_sampler_example.py>`_ |
168 | | - * - Grid |
169 | | - - `grid_sampler_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/optuna/grid_sampler_example.py>`_ |
| 64 | +:ref:`examples_sklearn_backend` |
| 65 | + Scikit-learn compatible interfaces as drop-in replacements for |
| 66 | + GridSearchCV and RandomizedSearchCV. |
170 | 67 |
|
171 | 68 |
|
172 | 69 | Integration Examples |
173 | | --------------------- |
174 | | - |
175 | | -Scikit-learn Integration |
176 | | -^^^^^^^^^^^^^^^^^^^^^^^^ |
177 | | - |
178 | | -.. list-table:: |
179 | | - :header-rows: 1 |
180 | | - :widths: 30 70 |
181 | | - |
182 | | - * - Use Case |
183 | | - - Example |
184 | | - * - Classification with OptCV |
185 | | - - `sklearn_classif_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/integrations/sklearn_classif_example.py>`_ |
186 | | - * - Grid Search |
187 | | - - `grid_search_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/sklearn/grid_search_example.py>`_ |
188 | | - * - Random Search |
189 | | - - `random_search_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/sklearn/random_search_example.py>`_ |
190 | | - |
191 | | - |
192 | | -Sktime Integration |
193 | | -^^^^^^^^^^^^^^^^^^ |
194 | | - |
195 | | -.. list-table:: |
196 | | - :header-rows: 1 |
197 | | - :widths: 30 70 |
198 | | - |
199 | | - * - Use Case |
200 | | - - Example |
201 | | - * - Time Series Forecasting |
202 | | - - `sktime_forecasting_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/integrations/sktime_forecasting_example.py>`_ |
203 | | - * - Time Series Classification |
204 | | - - `sktime_tsc_example.py <https://github.com/SimonBlanke/Hyperactive/blob/master/examples/integrations/sktime_tsc_example.py>`_ |
205 | | - |
206 | | - |
207 | | -Advanced Examples |
208 | | ------------------ |
209 | | - |
210 | | -Warm Starting Optimization |
211 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^ |
212 | | - |
213 | | -Start optimization from known good points: |
214 | | - |
215 | | -.. literalinclude:: _snippets/examples/advanced_examples.py |
216 | | - :language: python |
217 | | - :start-after: # [start:warm_starting] |
218 | | - :end-before: # [end:warm_starting] |
219 | | - |
220 | | - |
221 | | -Comparing Optimizers |
222 | 70 | ^^^^^^^^^^^^^^^^^^^^ |
223 | 71 |
|
224 | | -Compare different optimization strategies: |
225 | | - |
226 | | -.. literalinclude:: _snippets/examples/advanced_examples.py |
227 | | - :language: python |
228 | | - :start-after: # [start:comparing_optimizers] |
229 | | - :end-before: # [end:comparing_optimizers] |
230 | | - |
| 72 | +:ref:`examples_integrations` |
| 73 | + Time series optimization with sktime and other framework integrations. |
231 | 74 |
|
232 | | -Interactive Tutorial |
233 | | --------------------- |
234 | 75 |
|
235 | | -For a comprehensive interactive tutorial, see the |
236 | | -`Hyperactive Tutorial Notebook <https://nbviewer.org/github/SimonBlanke/hyperactive-tutorial/blob/main/notebooks/hyperactive_tutorial.ipynb>`_. |
| 76 | +Advanced Topics |
| 77 | +^^^^^^^^^^^^^^^ |
237 | 78 |
|
238 | | -This Jupyter notebook covers: |
| 79 | +:ref:`examples_other` |
| 80 | + Advanced usage patterns including warm starting and optimizer comparison. |
239 | 81 |
|
240 | | -- Basic optimization concepts |
241 | | -- All optimizer categories |
242 | | -- Real-world ML examples |
243 | | -- Best practices and tips |
| 82 | +:ref:`examples_interactive_tutorial` |
| 83 | + Comprehensive Jupyter notebook tutorial covering all Hyperactive features. |
0 commit comments