Skip to content

Commit 6f42283

Browse files
committed
deploy: 3b3cf4c
1 parent ad23eba commit 6f42283

34 files changed

+1299
-984
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: ae31d2ebb2d31cd3713ed60be8bf64ce
3+
config: 1c0e5fa47ecf51999eee0eaf240c9679
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_downloads/4ea8accded0d0e1c11374d507ee5380c/05-feature_interactions.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@
349349
" data=data,\n",
350350
" objective_func=objective_feature_interactions,\n",
351351
" max_time=run_time,\n",
352-
" step_spread=step_spread,\n",
352+
" initial_step_spread=step_spread,\n",
353353
" perturb_fraction=perturb_fraction,\n",
354354
" temperature=temperature,\n",
355355
" T_max=T_max,\n",

_downloads/5bf5751b91a019b446398b28327656d7/06-checkpoint_example.ipynb

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
},
128128
{
129129
"cell_type": "code",
130-
"execution_count": 4,
130+
"execution_count": null,
131131
"id": "7068938b",
132132
"metadata": {},
133133
"outputs": [
@@ -164,14 +164,13 @@
164164
}
165165
],
166166
"source": [
167-
"# Create climber with checkpoint file\n",
168-
"checkpoint_file = '../data/single_run_checkpoint.pkl'\n",
167+
"checkpoint_file = '../data/checkpoint_example.pkl'\n",
169168
"\n",
170169
"climber = HillClimber(\n",
171170
" data=data,\n",
172171
" objective_func=objective_same_mean_std_different_distributions,\n",
173172
" max_time=3, # 3 minutes\n",
174-
" step_spread=2.0,\n",
173+
" initial_step_spread=2.0,\n",
175174
" perturb_fraction=0.3,\n",
176175
" temperature=1000.0,\n",
177176
" cooling_rate=0.001,\n",
@@ -181,11 +180,11 @@
181180
")\n",
182181
"\n",
183182
"print(\"Starting optimization with periodic checkpointing...\")\n",
184-
"best_data, steps_df = climber.climb()\n",
183+
"best_data, history_df = climber.climb()\n",
185184
"\n",
186185
"print(f\"\\nOptimization completed!\")\n",
187-
"print(f\"Final objective: {steps_df['Objective value'].iloc[-1]:.4f}\")\n",
188-
"print(f\"Total steps: {len(steps_df)}\")"
186+
"print(f\"Final objective: {history_df['Objective value'].iloc[-1]:.4f}\")\n",
187+
"print(f\"Total improvements: {len(history_df)}\")"
189188
]
190189
},
191190
{
@@ -198,7 +197,7 @@
198197
},
199198
{
200199
"cell_type": "code",
201-
"execution_count": 5,
200+
"execution_count": null,
202201
"id": "fd27d5cd",
203202
"metadata": {},
204203
"outputs": [
@@ -244,11 +243,11 @@
244243
"resumed_climber.max_time = 2 # Run for 2 more minutes (total 5 minutes)\n",
245244
"\n",
246245
"# Continue optimization\n",
247-
"resumed_best_data, resumed_steps_df = resumed_climber.climb()\n",
246+
"resumed_best_data, resumed_history_df = resumed_climber.climb()\n",
248247
"\n",
249248
"print(f\"\\nResumed optimization completed!\")\n",
250-
"print(f\"Final objective: {resumed_steps_df['Objective value'].iloc[-1]:.4f}\")\n",
251-
"print(f\"Total steps after resume: {len(resumed_steps_df)}\")"
249+
"print(f\"Final objective: {resumed_history_df['Objective value'].iloc[-1]:.4f}\")\n",
250+
"print(f\"Total improvements after resume: {len(resumed_history_df)}\")"
252251
]
253252
},
254253
{
@@ -261,7 +260,7 @@
261260
},
262261
{
263262
"cell_type": "code",
264-
"execution_count": 6,
263+
"execution_count": null,
265264
"id": "3484e957",
266265
"metadata": {},
267266
"outputs": [
@@ -305,7 +304,7 @@
305304
" data=data,\n",
306305
" objective_func=objective_same_mean_std_different_distributions,\n",
307306
" max_time=3, # 3 minutes\n",
308-
" step_spread=2.0,\n",
307+
" initial_step_spread=2.0,\n",
309308
" perturb_fraction=0.3,\n",
310309
" temperature=100.0, # T_min\n",
311310
" T_max=1000.0, # T_max\n",
@@ -317,11 +316,11 @@
317316
")\n",
318317
"\n",
319318
"print(\"Starting replica exchange optimization with checkpointing...\")\n",
320-
"best_data_replica, steps_df_replica = replica_climber.climb()\n",
319+
"best_data_replica, history_df_replica = replica_climber.climb()\n",
321320
"\n",
322321
"print(\"\\nReplica exchange optimization completed!\")\n",
323-
"print(f\"Final objective: {steps_df_replica['Objective value'].iloc[-1]:.4f}\")\n",
324-
"print(f\"Total steps: {len(steps_df_replica)}\")"
322+
"print(f\"Final objective: {history_df_replica['Objective value'].iloc[-1]:.4f}\")\n",
323+
"print(f\"Total improvements: {len(history_df_replica)}\")"
325324
]
326325
},
327326
{
@@ -367,7 +366,7 @@
367366
},
368367
{
369368
"cell_type": "code",
370-
"execution_count": 8,
369+
"execution_count": null,
371370
"id": "42d31f16",
372371
"metadata": {},
373372
"outputs": [
@@ -400,10 +399,12 @@
400399
" # Show first replica info\n",
401400
" first_replica = checkpoint_data['replicas'][0]\n",
402401
" print(f\"\\nFirst replica state:\")\n",
403-
" print(f\" - Step: {first_replica['step']}\")\n",
402+
" print(f\" - Perturbation num: {first_replica['perturbation_num']}\")\n",
404403
" print(f\" - Best objective: {first_replica['best_objective']:.4f}\")\n",
405404
" print(f\" - Current temperature: {first_replica['temperature']:.2f}\")\n",
406405
" print(f\" - Hyperparameters: {list(first_replica['hyperparameters'].keys())}\")\n",
406+
" print(f\" - Num accepted: {first_replica['num_accepted']}\")\n",
407+
" print(f\" - Num improvements: {first_replica['num_improvements']}\")\n",
407408
"else:\n",
408409
" print(\"Checkpoint file not found\")"
409410
]

_downloads/7cac5e3eb3cf2b2a8cb6480f2cbb6aea/04-entropy_pearson.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326
" data=data,\n",
327327
" objective_func=objective_low_correlation_low_entropy,\n",
328328
" max_time=run_time,\n",
329-
" step_spread=step_spread,\n",
329+
" initial_step_spread=step_spread,\n",
330330
" perturb_fraction=perturb_fraction,\n",
331331
" temperature=temperature,\n",
332332
" T_max=T_max,\n",

_downloads/ccdc6e7f5698205511edc82076e3e802/02-pearson_spearman.ipynb

Lines changed: 29 additions & 63 deletions
Large diffs are not rendered by default.

_modules/hill_climber/climber_functions.html

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>hill_climber.climber_functions &mdash; Hill Climber 2.1.5 documentation</title>
8+
<title>hill_climber.climber_functions &mdash; Hill Climber 3.0.0 documentation</title>
99
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=b86133f3" />
1010
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=e59714d7" />
1111

1212

1313
<script src="../../_static/jquery.js?v=5d32c60e"></script>
1414
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
15-
<script src="../../_static/documentation_options.js?v=786ba454"></script>
15+
<script src="../../_static/documentation_options.js?v=acc74ff5"></script>
1616
<script src="../../_static/doctools.js?v=9bcbadda"></script>
1717
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
1818
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
@@ -43,12 +43,12 @@
4343
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
4444
<ul>
4545
<li class="toctree-l1"><a class="reference internal" href="../../installation.html">Installation</a></li>
46-
<li class="toctree-l1"><a class="reference internal" href="../../quickstart.html">Quick Start</a></li>
47-
<li class="toctree-l1"><a class="reference internal" href="../../user_guide.html">User Guide</a></li>
48-
<li class="toctree-l1"><a class="reference internal" href="../../dashboard.html">Real-Time Monitoring Dashboard</a></li>
49-
<li class="toctree-l1"><a class="reference internal" href="../../api.html">API Reference</a></li>
50-
<li class="toctree-l1"><a class="reference internal" href="../../notebooks.html">Example Notebooks</a></li>
51-
<li class="toctree-l1"><a class="reference internal" href="../../advanced.html">Advanced Topics</a></li>
46+
<li class="toctree-l1"><a class="reference internal" href="../../quickstart.html">Quick start</a></li>
47+
<li class="toctree-l1"><a class="reference internal" href="../../user_guide.html">User guide</a></li>
48+
<li class="toctree-l1"><a class="reference internal" href="../../dashboard.html">Real-time monitoring dashboard</a></li>
49+
<li class="toctree-l1"><a class="reference internal" href="../../api.html">API reference</a></li>
50+
<li class="toctree-l1"><a class="reference internal" href="../../notebooks.html">Example notebooks</a></li>
51+
<li class="toctree-l1"><a class="reference internal" href="../../advanced.html">Advanced topics</a></li>
5252
</ul>
5353

5454
</div>
@@ -91,7 +91,7 @@ <h1>Source code for hill_climber.climber_functions</h1><div class="highlight"><p
9191
<span class="sd"> </span>
9292
<span class="sd"> Args:</span>
9393
<span class="sd"> data_array (np.ndarray): 2D numpy array to perturb with shape (N, M).</span>
94-
<span class="sd"> step_spread (float): Standard deviation of normal distribution for perturbation.</span>
94+
<span class="sd"> step_spread (np.ndarray): Standard deviation of normal distribution for perturbation (per-feature).</span>
9595
<span class="sd"> n_perturb (int): Number of elements to perturb.</span>
9696
<span class="sd"> min_bounds (np.ndarray): 1D array of minimum bounds for each column.</span>
9797
<span class="sd"> max_bounds (np.ndarray): 1D array of maximum bounds for each column.</span>
@@ -108,7 +108,7 @@ <h1>Source code for hill_climber.climber_functions</h1><div class="highlight"><p
108108

109109
<span class="n">row_idx</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">n_rows</span><span class="p">)</span>
110110
<span class="n">col_idx</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">n_cols</span><span class="p">)</span>
111-
<span class="n">perturbation</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">step_spread</span><span class="p">)</span>
111+
<span class="n">perturbation</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">step_spread</span><span class="p">[</span><span class="n">col_idx</span><span class="p">])</span>
112112
<span class="n">new_value</span> <span class="o">=</span> <span class="n">result</span><span class="p">[</span><span class="n">row_idx</span><span class="p">,</span> <span class="n">col_idx</span><span class="p">]</span> <span class="o">+</span> <span class="n">perturbation</span>
113113

114114
<span class="c1"># Reflect values back into bounds instead of clipping</span>
@@ -152,8 +152,8 @@ <h1>Source code for hill_climber.climber_functions</h1><div class="highlight"><p
152152
<span class="sd"> Note: HillClimber uses 0.001 as its default.</span>
153153
<span class="sd"> bounds (tuple, optional): Tuple of (min_bounds, max_bounds) arrays for each column.</span>
154154
<span class="sd"> If None, uses data min/max. Default is None.</span>
155-
<span class="sd"> step_spread (float): Standard deviation of normal distribution for perturbations.</span>
156-
<span class="sd"> Default is 1.0.</span>
155+
<span class="sd"> step_spread (float or np.ndarray): Standard deviation of normal distribution for perturbations.</span>
156+
<span class="sd"> Can be a scalar (same for all features) or array (per-feature). Default is 1.0.</span>
157157
<span class="sd"> </span>
158158
<span class="sd"> Returns:</span>
159159
<span class="sd"> np.ndarray: Perturbed numpy array with same shape as input.</span>
@@ -171,6 +171,10 @@ <h1>Source code for hill_climber.climber_functions</h1><div class="highlight"><p
171171
<span class="k">else</span><span class="p">:</span>
172172
<span class="n">min_bounds</span><span class="p">,</span> <span class="n">max_bounds</span> <span class="o">=</span> <span class="n">bounds</span>
173173

174+
<span class="c1"># Ensure step_spread is an array (broadcast scalar if needed)</span>
175+
<span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">isscalar</span><span class="p">(</span><span class="n">step_spread</span><span class="p">):</span>
176+
<span class="n">step_spread</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">step_spread</span><span class="p">)</span>
177+
174178
<span class="c1"># Call JIT-compiled function</span>
175179
<span class="k">return</span> <span class="n">_perturb_core</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">step_spread</span><span class="p">,</span> <span class="n">n_perturb</span><span class="p">,</span> <span class="n">min_bounds</span><span class="p">,</span> <span class="n">max_bounds</span><span class="p">)</span></div>
176180

0 commit comments

Comments
 (0)