Skip to content

Commit 93d75c0

Browse files
committed
Merge branch 'main' into feature/simple-unified-search-space
2 parents 697391c + 7e049cb commit 93d75c0

34 files changed

Lines changed: 264 additions & 315 deletions

.github/workflows/auto-label-prs.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 47 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,81 @@
1-
# How to contribute
1+
# Contributing to Hyperactive
22

3-
There are many ways to contribute to this project. The following list should give you some ideas how to contribute. The only requirement for a contribution is that you are familiar with this project and understand the problems it is trying to solve.
3+
Thank you for your interest in contributing to Hyperactive. This project values self-directed contributors who bring their own ideas and experiences to the table.
44

55

6-
<br>
6+
## Before You Contribute
77

8-
## Discussions
8+
The best contributions come from people who actively use the library. Before contributing, we recommend:
99

10-
You can contribute to this project by taking part in a discussion.
10+
- **Use Hyperactive in your own projects** - Hands-on experience helps you identify real problems and useful improvements
11+
- **Explore the codebase** - Understand the architecture and design decisions
12+
- **Read existing issues and discussions** - Get familiar with ongoing conversations and past decisions
1113

1214

13-
<br>
15+
## Ways to Contribute
1416

15-
#### - Upvoting an issue
17+
### Feedback and Discussions
1618

17-
The easiest way to contribute is to upvote an issue (with a thumbs up emojy) that is important to you. This way I can see which bugfix, feature or question is important to my users.
19+
- **Upvote issues** that are important to you
20+
- **Share your use cases** - How are you using Hyperactive? What works well?
21+
- **Participate in discussions** - Your domain expertise can help shape the project
1822

1923

20-
<br>
24+
### Opening Issues
2125

22-
#### - Take part in discussions
26+
#### Bug Reports
2327

24-
If you have experience in a topic, that touches the issue you might be able to participate in the discussion.
28+
If you encounter a bug while using Hyperactive:
2529

30+
1. Search existing issues to avoid duplicates
31+
2. Use the bug report template
32+
3. Include a minimal reproducible example
33+
4. Describe what you expected vs. what happened
2634

27-
<br>
35+
#### Feature Requests
2836

29-
#### - Reproduce a bug
37+
Feature requests are most valuable when they come from real usage experience:
3038

31-
An issue about a bug can benefit from users reproducing the bug and therefore confirm, that the bug exists.
39+
1. Describe the problem you're trying to solve
40+
2. Explain your current workaround (if any)
41+
3. Suggest a solution if you have one in mind
3242

43+
#### Questions
3344

34-
<br>
45+
Before asking a question:
3546

36-
## Create a pull request
47+
1. Check the documentation
48+
2. Search existing issues and discussions
49+
3. If still unclear, open an issue with specific details
3750

38-
A more difficult way to contribute is to open a pull request.
3951

52+
### Pull Requests
4053

41-
<br>
54+
#### Before Starting
4255

43-
#### - Corrections in Readme
56+
- **Discuss first** - Open an issue to discuss your idea before writing code
57+
- **One change per PR** - Keep pull requests focused on a single improvement
4458

45-
If you want to start easy you can create a pull request, that corrects a mistake in the readme. Those mistakes could be from wrong spelling or a wrong default value in the API reference.
59+
#### When Submitting
4660

61+
- **Understand the code you're changing** - Be prepared to explain your changes and their implications
62+
- **Test thoroughly** - Verify your changes work as intended
63+
- **Explain the "why"** - Help reviewers understand the reasoning behind your changes
4764

48-
<br>
65+
#### PR Format
4966

50-
#### - Add an example
67+
- Use tags in the title: `[Fix]`, `[Feature]`, `[Refactor]`, `[Docs]`
68+
- Link to the related issue
69+
- Describe what changed and why
5170

52-
A great way to conribute is to add an example from you field of work, that incorporates this package.
5371

72+
## Code Style
5473

55-
<br>
74+
- Follow the existing code style in the repository
75+
- Run the test suite before submitting
76+
- Keep commits focused and well-described
5677

57-
#### - Solve an existing issue
5878

59-
Solving an issue with a pull request is one of the most difficult ways to contribute. If you need help with the solution you can ask it in the corresponding issue or contact me at my official email (from my profile page).
79+
## Code of Conduct
6080

61-
62-
<br>
63-
64-
## Open an issue
65-
66-
You can contribute to this project by opening an issue. This could be a question, a bug report, a feature request or other types. In any case you should do a search beforehand to confirm, that a similar issue has not already been opened.
67-
68-
69-
<br>
70-
71-
#### - Questions
72-
73-
This can be a question about how an algorithm works or if something in the documentation is not clear.
74-
75-
76-
<br>
77-
78-
#### - Bug reports
79-
80-
If you encounter an error with this software you should open an issue. Please look into the error message to verify if the origin of the error is in this software. If you decide to open an issue about a bug report you should select the issue template and follow the instructions.
81-
82-
83-
<br>
84-
85-
#### - Feature Requests
86-
87-
This could be a feature that could be very useful for your work, an interesting algorithm or a way to open up the software to more usecases.
88-
89-
90-
<br>
91-
92-
---
93-
94-
<br>
95-
<br>
96-
<br>
97-
98-
# Contribution Guidelines
99-
100-
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
101-
102-
Please note we have a code of conduct, please follow it in all your interactions with the project.
103-
104-
105-
<br>
106-
107-
## Issues
108-
109-
Before opening an issue, please use the search to find out if your problem or question has already been adressed before.
110-
When opening issues, please use the issue templates and try to describe your problem in detail.
111-
112-
If you open an issue that describes a bug, please add a small example code snippet. This helps to reproduce the bug, which speeds up the process of fixing the bug.
113-
114-
115-
<br>
116-
117-
## Pull Requests
118-
119-
- In the PR title use tags [Fix], [Feature], [Refactor], [Release], [Hotfix]
120-
- Link PR to issue of it solves one.
121-
- Explain how you solved the issue
122-
- Check the Format und Coding Style
123-
124-
125-
<br>
126-
127-
---
81+
Please be respectful in all interactions. We're all here to build something useful together.

docs/source/_snippets/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@pytest.fixture
1212
def simple_search_space():
13-
"""Simple search space for basic examples."""
13+
"""Provide simple search space for basic examples."""
1414
return {
1515
"x": np.arange(-5, 5, 0.1),
1616
"y": np.arange(-5, 5, 0.1),
@@ -19,7 +19,7 @@ def simple_search_space():
1919

2020
@pytest.fixture
2121
def simple_objective():
22-
"""Simple objective function for basic examples."""
22+
"""Provide simple objective function for basic examples."""
2323

2424
def objective(params):
2525
x = params["x"]

docs/source/_snippets/examples/advanced_examples.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
advanced functionality like warm starting and optimizer comparison.
55
"""
66

7-
import numpy as np
87
from sklearn.datasets import load_wine
98
from sklearn.ensemble import RandomForestClassifier
9+
1010
from hyperactive.experiment.integrations import SklearnCvExperiment
1111
from hyperactive.opt.gfo import HillClimbing
1212

1313
# Setup common fixtures for examples
1414
X, y = load_wine(return_X_y=True)
1515
experiment = SklearnCvExperiment(
1616
estimator=RandomForestClassifier(random_state=42),
17-
X=X, y=y, cv=3,
17+
X=X,
18+
y=y,
19+
cv=3,
1820
)
1921
search_space = {
2022
"n_estimators": list(range(10, 101, 10)),
@@ -24,7 +26,6 @@
2426

2527

2628
# [start:warm_starting]
27-
from hyperactive.opt.gfo import HillClimbing
2829

2930
# Previous best parameters
3031
warm_start_points = [
@@ -33,7 +34,7 @@
3334

3435
optimizer = HillClimbing(
3536
search_space=search_space,
36-
n_iter=40,
37+
n_iter=5,
3738
experiment=experiment,
3839
initialize={"warm_start": warm_start_points},
3940
)
@@ -43,10 +44,10 @@
4344

4445
# [start:comparing_optimizers]
4546
from hyperactive.opt.gfo import (
46-
HillClimbing,
47-
RandomSearch,
4847
BayesianOptimizer,
48+
HillClimbing,
4949
ParticleSwarmOptimizer,
50+
RandomSearch,
5051
)
5152

5253
optimizers = {
@@ -60,7 +61,7 @@
6061
for name, OptClass in optimizers.items():
6162
optimizer = OptClass(
6263
search_space=search_space,
63-
n_iter=50,
64+
n_iter=5,
6465
experiment=experiment,
6566
random_state=42,
6667
)

docs/source/_snippets/examples/basic_examples.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88

99
# [start:custom_function]
10-
import numpy as np
1110
from hyperactive.opt.gfo import HillClimbing
1211

1312

@@ -24,7 +23,7 @@ def objective(params):
2423

2524
optimizer = HillClimbing(
2625
search_space=search_space,
27-
n_iter=100,
26+
n_iter=5,
2827
experiment=objective,
2928
)
3029
best_params = optimizer.solve()
@@ -35,6 +34,7 @@ def objective(params):
3534
# [start:sklearn_tuning]
3635
from sklearn.datasets import load_wine
3736
from sklearn.ensemble import RandomForestClassifier
37+
3838
from hyperactive.experiment.integrations import SklearnCvExperiment
3939
from hyperactive.opt.gfo import HillClimbing
4040

@@ -44,7 +44,9 @@ def objective(params):
4444
# Create experiment
4545
experiment = SklearnCvExperiment(
4646
estimator=RandomForestClassifier(random_state=42),
47-
X=X, y=y, cv=3,
47+
X=X,
48+
y=y,
49+
cv=3,
4850
)
4951

5052
# Define search space
@@ -58,7 +60,7 @@ def objective(params):
5860
# Optimize
5961
optimizer = HillClimbing(
6062
search_space=search_space,
61-
n_iter=40,
63+
n_iter=5,
6264
random_state=42,
6365
experiment=experiment,
6466
)

docs/source/_snippets/getting_started/bayesian_optimizer.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"""
66

77
# [start:full_example]
8-
from hyperactive.opt.gfo import BayesianOptimizer
98
# [end:full_example]
10-
119
# Need to define experiment and search_space for standalone execution
1210
import numpy as np
1311

12+
from hyperactive.opt.gfo import BayesianOptimizer
13+
1414

1515
def experiment(params):
16-
"""Simple objective function."""
16+
"""Compute simple objective function."""
1717
x = params["x"]
1818
y = params["y"]
1919
return -(x**2 + y**2)
@@ -27,15 +27,16 @@ def experiment(params):
2727
# [start:optimizer_usage]
2828
optimizer = BayesianOptimizer(
2929
search_space=search_space,
30-
n_iter=30,
30+
n_iter=5,
3131
experiment=experiment,
3232
)
3333
best_params = optimizer.solve()
3434
# [end:optimizer_usage]
3535

3636
if __name__ == "__main__":
3737
print(f"Best parameters: {best_params}")
38-
# Verify the optimization found parameters close to (0, 0)
39-
assert abs(best_params["x"]) < 2.0, f"Expected x near 0, got {best_params['x']}"
40-
assert abs(best_params["y"]) < 2.0, f"Expected y near 0, got {best_params['y']}"
38+
# Verify the optimization returned valid parameters
39+
assert "x" in best_params and "y" in best_params
40+
assert -5 <= best_params["x"] <= 5, f"x out of range: {best_params['x']}"
41+
assert -5 <= best_params["y"] <= 5, f"y out of range: {best_params['y']}"
4142
print("Bayesian optimizer example passed!")

docs/source/_snippets/getting_started/index_bayesian.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
# [start:full_example]
88
import numpy as np
9+
910
from hyperactive.opt.gfo import BayesianOptimizer
1011

1112

@@ -22,7 +23,7 @@ def complex_objective(params):
2223

2324
optimizer = BayesianOptimizer(
2425
search_space=search_space,
25-
n_iter=50,
26+
n_iter=5,
2627
experiment=complex_objective,
2728
)
2829
best_params = optimizer.solve()

0 commit comments

Comments
 (0)