Skip to content

Commit 2e7571e

Browse files
committed
Merge branch 'main' into feature/add-scipy-backend
2 parents 30ab43f + fea4164 commit 2e7571e

35 files changed

+1921
-958
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@
1010

1111
<!-- Mark the applicable option with [x] -->
1212

13-
- [ ] `[Fix]` - Bug fix (non-breaking change fixing an issue)
14-
- [ ] `[Feature]` - New feature (non-breaking change adding functionality)
15-
- [ ] `[Refactor]` - Code refactoring (no functional changes)
16-
- [ ] `[Release]` - Release preparation
17-
- [ ] `[Hotfix]` - Critical fix for production
13+
- [ ] `[BUG]` - Bug fix (non-breaking change fixing an issue)
14+
- [ ] `[ENH]` - New feature (non-breaking change adding functionality)
15+
- [ ] `[DOC]` - Documentation changes
16+
- [ ] `[MNT]` - Maintenance
1817

1918
## How was this solved?
2019

2120
<!-- Explain your approach to solving the issue -->
2221

2322
## Checklist
2423

25-
- [ ] PR title includes appropriate tag: `[Fix]`, `[Feature]`, `[Refactor]`, `[Release]`, or `[Hotfix]`
24+
- [ ] PR title includes appropriate tag: `[BUG]`, `[ENH]`, `[DOC]` or `[MNT]`
2625
- [ ] Linked to related issue (if applicable)
2726
- [ ] Code passes `make check` (lint, format, isort)
2827
- [ ] Tests added/updated for changes (if applicable)

docs/source/_snippets/user_guide/introduction.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
X = X_train
1414
y = y_train
1515

16+
# [start:simplest_example]
17+
from hyperactive.opt.gfo import HillClimbing
18+
19+
def score(p):
20+
return -(p["x"] ** 2) # Find x that minimizes x²
21+
22+
opt = HillClimbing({"x": range(-10, 11)}, experiment=score)
23+
best = opt.solve() # {"x": 0}
24+
# [end:simplest_example]
25+
26+
1627
# [start:simple_objective]
1728
def objective(params):
1829
x = params["x"]
@@ -35,6 +46,14 @@ def objective(params):
3546
# [end:sklearn_experiment_intro]
3647

3748

49+
# [start:sklearn_3_lines]
50+
from hyperactive.experiment.integrations import SklearnCvExperiment
51+
from sklearn.ensemble import GradientBoostingClassifier
52+
53+
experiment = SklearnCvExperiment(GradientBoostingClassifier(), X, y, cv=5)
54+
# [end:sklearn_3_lines]
55+
56+
3857
# [start:optimizer_imports]
3958
from hyperactive.opt.gfo import (
4059
HillClimbing, # Local search
@@ -118,6 +137,67 @@ def my_objective(params):
118137
# [end:warm_starting]
119138

120139

140+
# [start:swap_hill_climbing]
141+
from hyperactive.opt.gfo import HillClimbing
142+
143+
optimizer = HillClimbing(search_space, experiment=experiment)
144+
best = optimizer.solve()
145+
# [end:swap_hill_climbing]
146+
147+
148+
# [start:swap_bayesian]
149+
from hyperactive.opt.gfo import BayesianOptimizer
150+
151+
optimizer = BayesianOptimizer(search_space, experiment=experiment)
152+
best = optimizer.solve()
153+
# [end:swap_bayesian]
154+
155+
156+
# [start:swap_genetic]
157+
from hyperactive.opt.gfo import GeneticAlgorithmOptimizer
158+
159+
optimizer = GeneticAlgorithmOptimizer(search_space, experiment=experiment)
160+
best = optimizer.solve()
161+
# [end:swap_genetic]
162+
163+
164+
# [start:complete_example]
165+
import numpy as np
166+
from sklearn.datasets import load_iris
167+
from sklearn.ensemble import RandomForestClassifier
168+
from hyperactive.experiment.integrations import SklearnCvExperiment
169+
from hyperactive.opt.gfo import BayesianOptimizer
170+
171+
# 1. Load your data
172+
X, y = load_iris(return_X_y=True)
173+
174+
# 2. Define the experiment (what to optimize)
175+
experiment = SklearnCvExperiment(
176+
estimator=RandomForestClassifier(),
177+
X=X, y=y, cv=5,
178+
)
179+
180+
# 3. Define the search space (where to search)
181+
search_space = {
182+
"n_estimators": list(range(10, 200, 10)),
183+
"max_depth": [3, 5, 10, 20, None],
184+
"min_samples_split": [2, 5, 10],
185+
}
186+
187+
# 4. Choose an optimizer (how to search)
188+
optimizer = BayesianOptimizer(
189+
search_space=search_space,
190+
n_iter=50,
191+
experiment=experiment,
192+
random_state=42,
193+
)
194+
195+
# 5. Run and get the best parameters
196+
best_params = optimizer.solve()
197+
print(f"Best parameters: {best_params}")
198+
# [end:complete_example]
199+
200+
121201
if __name__ == "__main__":
122202
# The actual test code runs here
123203
print("Introduction snippet file is importable!")

docs/source/_static/css/custom.css

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/* Custom CSS for Hyperactive documentation */
22
/* Purple/Violet theme matching the Hyperactive logo */
33

4-
/* ============================================
5-
Google Font Import for Hero Title
6-
============================================ */
7-
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;600;700&display=swap');
4+
/* NOTE: Raleway font is loaded via layout.html with preload for better performance.
5+
This prevents the Flash of Unstyled Text (FOUT) on the hero title. */
86

97
/* ============================================
108
PyData Theme Color Overrides (purple theme)
@@ -132,6 +130,29 @@ html[data-theme="dark"] {
132130
margin-top: 1.25rem;
133131
}
134132

133+
/* Remove vertical line from right sidebar */
134+
.bd-sidebar-secondary .toc-entry,
135+
.bd-sidebar-secondary nav.page-toc {
136+
border-left: none;
137+
}
138+
139+
/* Right sidebar slide-in animation on page load */
140+
@keyframes slideInFromLeft {
141+
from {
142+
opacity: 0;
143+
transform: translateX(-20px);
144+
}
145+
to {
146+
opacity: 1;
147+
transform: translateX(0);
148+
}
149+
}
150+
151+
.bd-sidebar-secondary {
152+
min-width: 200px;
153+
animation: slideInFromLeft 0.3s ease forwards;
154+
}
155+
135156
.pst-page-navigation-heading {
136157
margin-bottom: 0.5rem;
137158
}
@@ -273,6 +294,11 @@ html[data-theme="dark"] .back-to-top-sidebar a:hover {
273294
background: var(--pst-color-background);
274295
}
275296

297+
a.stat-item {
298+
text-decoration: none;
299+
color: inherit;
300+
}
301+
276302
.stat-value {
277303
font-size: 1.75rem;
278304
font-weight: 700;
@@ -925,14 +951,43 @@ hr {
925951
}
926952

927953
/* ============================================
928-
Section Headers - Clean without decorative underlines
954+
Section Headers - Subtle styling
929955
============================================ */
930-
h2 {
956+
957+
/* Page titles (h1 from ===) - subtle background highlight */
958+
/* Exclude home page by targeting pages with h1 that aren't in the hero */
959+
article h1:not(.hero-title) {
960+
background-color: rgba(93, 93, 122, 0.2);
961+
padding: 0.5rem 0.75rem;
962+
border-radius: 4px;
963+
width: fit-content;
964+
}
965+
966+
/* Home page h1s get h2 styling (underline, not background) */
967+
/* Target pages that contain .hero-section */
968+
article:has(.hero-section) h1 {
969+
background-color: transparent;
970+
padding: 0;
971+
border-radius: 0;
972+
width: auto;
973+
padding-bottom: 0.4rem;
974+
border-bottom: 1px solid var(--pst-color-border);
975+
}
976+
977+
/* Remove headerlink from affecting h1 width */
978+
article h1 a.headerlink {
979+
position: absolute;
980+
margin-left: 0.5rem;
981+
}
982+
983+
/* Section titles (h2 from ---) - subtle underline */
984+
article h2 {
931985
position: relative;
932-
padding-bottom: 0;
986+
padding-bottom: 0.4rem;
987+
border-bottom: 1px solid var(--pst-color-border);
933988
}
934989

935-
/* Remove the short underline pseudo-element */
990+
/* Remove any pseudo-element underlines */
936991
h2::after {
937992
display: none;
938993
}
@@ -1298,3 +1353,23 @@ html[data-theme="dark"] .segmented-tab-btn.active {
12981353
padding: 0.5rem 0.75rem;
12991354
}
13001355
}
1356+
1357+
/* ============================================
1358+
Theme-Aware Diagrams
1359+
============================================ */
1360+
1361+
/* Container for theme-aware images */
1362+
.theme-aware-diagram {
1363+
width: 100%;
1364+
text-align: center;
1365+
}
1366+
1367+
.theme-aware-diagram img {
1368+
max-width: 100%;
1369+
height: auto;
1370+
}
1371+
1372+
/* Override pydata theme's white background for diagram images */
1373+
html[data-theme="dark"] .theme-aware-diagram img.only-dark {
1374+
background-color: transparent !important;
1375+
}

0 commit comments

Comments
 (0)