Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Added tutorial and embended existing colab tutorial in it.
- Added 3 tutorials and embended existing colab tutorial in it.

## [0.16.0] - 2026-03-25

Expand Down
15 changes: 5 additions & 10 deletions tutorials/1_getting_started_hpo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"metadata": {},
"outputs": [],
"source": [
"# %%\n",
"!git clone --depth 1 https://github.com/automl/neps.git /content/neps\n",
"%cd /content/neps\n",
"!pip install -e /content/neps"
Expand All @@ -47,7 +46,6 @@
"metadata": {},
"outputs": [],
"source": [
"# %%\n",
"import math\n",
"import neps\n",
"import logging"
Expand Down Expand Up @@ -84,7 +82,7 @@
" c = 5 / math.pi\n",
" r = 6\n",
" s = 10\n",
" t = 1 / 8 * math.pi\n",
" t = 1 / (8 * math.pi)\n",
"\n",
" f = a * (x2 - b * x1**2 + c * x1 - r) ** 2 + s * (1 - t) * math.cos(x1) + s\n",
" return f"
Expand All @@ -99,7 +97,6 @@
},
"outputs": [],
"source": [
"# %%\n",
"# Define the search space and run optimization\n",
"class BraninSpace(neps.PipelineSpace):\n",
" x1 = neps.Float(-5, 10)\n",
Expand All @@ -113,6 +110,8 @@
"metadata": {},
"outputs": [],
"source": [
"from tutorials.utils import set_seeds\n",
"set_seeds(1)\n",
"neps.run(\n",
" pipeline_space=BraninSpace(),\n",
" root_directory=\"branin_demo/\",\n",
Expand All @@ -138,7 +137,7 @@
"id": "aeac2466",
"metadata": {},
"source": [
"Great! NePS found the minimum loss over 25 evaluations. \n",
"Great! NePS went in the direction of minimum loss over 25 evaluations. If you increase the budget to 1000 evaluations, you can get even closer to the global minimum of 0.397887.\n",
"The NePS workflow always follows this pattern:\n",
"1. **Define** an objective function\n",
"2. **Specify** a search space\n",
Expand All @@ -163,9 +162,7 @@
"metadata": {},
"outputs": [],
"source": [
"# %%\n",
"from tutorials.train import training_pipeline\n",
"from tutorials.utils import set_seeds"
"from tutorials.train import training_pipeline"
]
},
{
Expand Down Expand Up @@ -296,7 +293,6 @@
"metadata": {},
"outputs": [],
"source": [
"# %%\n",
"# View the summary files:\n",
"!cat results_hpo_demo/summary/short.csv"
]
Expand Down Expand Up @@ -371,7 +367,6 @@
"lines_to_next_cell": 2
},
"source": [
"%% [markdown]\n",
"For more details on the Tensorboard integration, see documentation [here](https://automl.github.io/neps/latest/reference/analyse/#visualizing-results).\n",
"\n",
"## A slightly more elaborate HPO\n",
Expand Down
13 changes: 4 additions & 9 deletions tutorials/1_getting_started_hpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
# ## Installation
# Requires Python 3.10+. Install NePS via:

# %%
# !git clone --depth 1 https://github.com/automl/neps.git /content/neps
# %cd /content/neps
# !pip install -e /content/neps

# ## Example 1: Synthetic Function Optimization
# We start with a simple optimization problem to understand NePS basics.

# %%
import math
import neps
import logging
Expand All @@ -43,17 +41,18 @@ def branin(x1, x2):
c = 5 / math.pi
r = 6
s = 10
t = 1 / 8 * math.pi
t = 1 / (8 * math.pi)

f = a * (x2 - b * x1**2 + c * x1 - r) ** 2 + s * (1 - t) * math.cos(x1) + s
return f

# %%
# Define the search space and run optimization
class BraninSpace(neps.PipelineSpace):
x1 = neps.Float(-5, 10)
x2 = neps.Float(0, 15)

from tutorials.utils import set_seeds
set_seeds(1)
neps.run(
pipeline_space=BraninSpace(),
root_directory="branin_demo/",
Expand All @@ -65,7 +64,7 @@ class BraninSpace(neps.PipelineSpace):
# Check the optimization results:
#!tail ./branin_demo/summary/best_config.txt

# Great! NePS found the minimum loss over 25 evaluations.
# Great! NePS went in the direction of minimum loss over 25 evaluations. If you increase the budget to 1000 evaluations, you can get even closer to the global minimum of 0.397887.
# The NePS workflow always follows this pattern:
# 1. **Define** an objective function
# 2. **Specify** a search space
Expand All @@ -76,9 +75,7 @@ class BraninSpace(neps.PipelineSpace):
#
# For the full training code, see [train.py](https://github.com/automl/neps/blob/master/tutorials/train.py).

# %%
from tutorials.train import training_pipeline
from tutorials.utils import set_seeds

# Test the training pipeline with a small subset
training_pipeline(
Expand Down Expand Up @@ -139,7 +136,6 @@ class HPODemoSpace(neps.PipelineSpace):

!python -m neps.status results_hpo_demo/

# %%
# View the summary files:
!cat results_hpo_demo/summary/short.csv

Expand All @@ -158,7 +154,6 @@ class HPODemoSpace(neps.PipelineSpace):

# %tensorboard --logdir /content/neps/results_hpo_demo

# %% [markdown]
# For more details on the Tensorboard integration, see documentation [here](https://automl.github.io/neps/latest/reference/analyse/#visualizing-results).
#
# ## A slightly more elaborate HPO
Expand Down
Loading
Loading