Skip to content

Commit 0c2c9c1

Browse files
authored
feat: Txt files fidelity stopping crit (#230)
2 parents 8bd516e + e5ad72d commit 0c2c9c1

40 files changed

+589
-217
lines changed

.trace.lock

Whitespace-only changes.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ neps.run(
7979
evaluate_pipeline=evaluate_pipeline,
8080
pipeline_space=pipeline_space,
8181
root_directory="path/to/save/results", # Replace with the actual path.
82-
max_evaluations_total=100,
82+
evaluations_to_spend=100,
8383
)
8484
```
8585

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ neps.run(
8787
evaluate_pipeline=evaluate_pipeline,
8888
pipeline_space=pipeline_space,
8989
root_directory="path/to/save/results", # Replace with the actual path.
90-
max_evaluations_total=100,
90+
evaluations_to_spend=100,
9191
)
9292
```
9393

docs/reference/analyse.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ Currently, this creates one plot that shows the best error value across the numb
4040

4141
## What's on disk?
4242
In the root directory, NePS maintains several files at all times that are human readable and can be useful
43-
If you pass the `post_run_summary=` argument to [`neps.run()`][neps.api.run],
44-
NePS will also generate a summary CSV file for you.
43+
If you pass the `write_summary_to_disk=` argument to [`neps.run()`][neps.api.run],
44+
NePS will generate a summary CSV and TXT files for you.
4545

46-
=== "`neps.run(..., post_run_summary=True)`"
46+
=== "`neps.run(..., write_summary_to_disk=True)`"
4747

4848
```
4949
ROOT_DIRECTORY
@@ -54,13 +54,15 @@ NePS will also generate a summary CSV file for you.
5454
│ └── report.yaml
5555
├── summary
5656
│ ├── full.csv
57-
│ └── short.csv
57+
│ ├── short.csv
58+
│ ├── best_config_trajectory.txt
59+
│ └── best_config.txt
5860
├── optimizer_info.yaml
5961
└── optimizer_state.pkl
6062
```
6163

6264

63-
=== "`neps.run(..., post_run_summary=False)`"
65+
=== "`neps.run(..., write_summary_to_disk=False)`"
6466

6567
```
6668
ROOT_DIRECTORY
@@ -77,8 +79,8 @@ NePS will also generate a summary CSV file for you.
7779
The `full.csv` contains all configuration details in CSV format.
7880
Details include configuration hyperparameters and any returned result and cost from the `evaluate_pipeline` function.
7981

80-
The `run_status.csv` provides general run details, such as the number of failed and successful configurations,
81-
and the best configuration with its corresponding objective value.
82+
The `best_config_trajectory.txt` contains logging of the incumbent trajectory.
83+
The `best_config.txt` records current incumbent.
8284

8385
# TensorBoard Integration
8486

docs/reference/evaluate_pipeline.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ def evaluate_pipeline(
6363

6464
#### Cost
6565

66-
Along with the return of the `loss`, the `evaluate_pipeline=` function would optionally need to return a `cost` in certain cases. Specifically when the `max_cost_total` parameter is being utilized in the `neps.run` function.
66+
Along with the return of the `loss`, the `evaluate_pipeline=` function would optionally need to return a `cost` in certain cases. Specifically when the `cost_to_spend` parameter is being utilized in the `neps.run` function.
6767

6868

6969
!!! note
7070

71-
`max_cost_total` sums the cost from all returned configuration results and checks whether the maximum allowed cost has been reached (if so, the search will come to an end).
71+
`cost_to_spend` sums the cost from all returned configuration results and checks whether the maximum allowed cost has been reached (if so, the search will come to an end).
7272

7373
```python
7474
import neps
@@ -97,7 +97,7 @@ if __name__ == "__main__":
9797
evaluate_pipeline=evaluate_pipeline,
9898
pipeline_space=pipeline_space, # Assuming the pipeline space is defined
9999
root_directory="results/bo",
100-
max_cost_total=10,
100+
cost_to_spend=10,
101101
optimizer="bayesian_optimization",
102102
)
103103
```

docs/reference/neps_run.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ See the following for more:
4545
* What goes in and what goes out of [`evaluate_pipeline()`](../reference/evaluate_pipeline.md)?
4646

4747
## Budget, how long to run?
48-
To define a budget, provide `max_evaluations_total=` to [`neps.run()`][neps.api.run],
48+
To define a budget, provide `evaluations_to_spend=` to [`neps.run()`][neps.api.run],
4949
to specify the total number of evaluations to conduct before halting the optimization process,
50-
or `max_cost_total=` to specify a cost threshold for your own custom cost metric, such as time, energy, or monetary, as returned by each evaluation of the pipeline .
50+
or `cost_to_spend=` to specify a cost threshold for your own custom cost metric, such as time, energy, or monetary, as returned by each evaluation of the pipeline .
5151

5252

5353
```python
@@ -60,8 +60,8 @@ def evaluate_pipeline(learning_rate: float, epochs: int) -> float:
6060
return {"objective_function_to_minimize": loss, "cost": duration}
6161

6262
neps.run(
63-
max_evaluations_total=10, # (1)!
64-
max_cost_total=1000, # (2)!
63+
evaluations_to_spend=10, # (1)!
64+
cost_to_spend=1000, # (2)!
6565
)
6666
```
6767

@@ -87,7 +87,7 @@ Please refer to Python's [logging documentation](https://docs.python.org/3/libra
8787

8888
## Continuing Runs
8989
To continue a run, all you need to do is provide the same `root_directory=` to [`neps.run()`][neps.api.run] as before,
90-
with an increased `max_evaluations_total=` or `max_cost_total=`.
90+
with an increased `evaluations_to_spend=` or `cost_to_spend=`.
9191

9292
```python
9393
def run(learning_rate: float, epochs: int) -> float:
@@ -100,21 +100,21 @@ def run(learning_rate: float, epochs: int) -> float:
100100

101101
neps.run(
102102
# Increase the total number of trials from 10 as set previously to 50
103-
max_evaluations_total=50,
103+
evaluations_to_spend=50,
104104
)
105105
```
106106

107107
If the run previously stopped due to reaching a budget and you specify the same budget, the worker will immediatly stop as it will remember the amount of budget it used previously.
108108

109109
## Overwriting a Run
110110

111-
To overwrite a run, simply provide the same `root_directory=` to [`neps.run()`][neps.api.run] as before, with the `overwrite_working_directory=True` argument.
111+
To overwrite a run, simply provide the same `root_directory=` to [`neps.run()`][neps.api.run] as before, with the `overwrite_root_directory=True` argument.
112112

113113
```python
114114
neps.run(
115115
...,
116116
root_directory="path/to/previous_result_dir",
117-
overwrite_working_directory=True,
117+
overwrite_root_directory=True,
118118
)
119119
```
120120

@@ -125,9 +125,6 @@ neps.run(
125125
## Getting the results
126126
The results of the optimization process are stored in the `root_directory=`
127127
provided to [`neps.run()`][neps.api.run].
128-
To obtain a summary of the optimization process, you can enable the
129-
`post_run_summary=True` argument in [`neps.run()`][neps.api.run],
130-
while will generate a summary csv after the run has finished.
131128

132129
=== "Result Directory"
133130

@@ -143,17 +140,19 @@ while will generate a summary csv after the run has finished.
143140
│ └── config_2
144141
│ ├── config.yaml
145142
│ └── metadata.json
146-
├── summary # Only if post_run_summary=True
143+
├── summary
147144
│ ├── full.csv
148145
│ └── short.csv
146+
│ ├── best_config_trajectory.txt
147+
│ └── best_config.txt
149148
├── optimizer_info.yaml # The optimizer's configuration
150149
└── optimizer_state.pkl # The optimizer's state, shared between workers
151150
```
152151

153152
=== "python"
154153

155154
```python
156-
neps.run(..., post_run_summary=True)
155+
neps.run(..., write_summary_to_disk=True)
157156
```
158157

159158
To capture the results of the optimization process, you can use tensorbaord logging with various utilities to integrate
@@ -174,20 +173,20 @@ Any new workers that come online will automatically pick up work and work togeth
174173
evaluate_pipeline=...,
175174
pipeline_space=...,
176175
root_directory="some/path",
177-
max_evaluations_total=100,
176+
evaluations_to_spend=100,
178177
max_evaluations_per_run=10, # (1)!
179178
continue_until_max_evaluation_completed=True, # (2)!
180-
overwrite_working_directory=False, #!!!
179+
overwrite_root_directory=False, #!!!
181180
)
182181
```
183182

184183
1. Limits the number of evaluations for this specific call of [`neps.run()`][neps.api.run].
185-
2. Evaluations in-progress count towards max_evaluations_total, halting new ones when this limit is reached.
186-
Setting this to `True` enables continuous sampling of new evaluations until the total of completed ones meets max_evaluations_total, optimizing resource use in time-sensitive scenarios.
184+
2. Evaluations in-progress count towards evaluations_to_spend, halting new ones when this limit is reached.
185+
Setting this to `True` enables continuous sampling of new evaluations until the total of completed ones meets evaluations_to_spend, optimizing resource use in time-sensitive scenarios.
187186

188187
!!! warning
189188

190-
Ensure `overwrite_working_directory=False` to prevent newly spawned workers from deleting the shared directory!
189+
Ensure `overwrite_root_directory=False` to prevent newly spawned workers from deleting the shared directory!
191190

192191

193192
=== "Shell"
@@ -227,7 +226,7 @@ neps.run(
227226

228227
!!! note
229228

230-
Any runs that error will still count towards the total `max_evaluations_total` or `max_evaluations_per_run`.
229+
Any runs that error will still count towards the total `evaluations_to_spend` or `max_evaluations_per_run`.
231230

232231
### Re-running Failed Configurations
233232

docs/reference/optimizers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ neps.run(
7272
evaluate_pipeline=run_function,
7373
pipeline_space=pipeline_space,
7474
root_directory="results/",
75-
max_evaluations_total=25,
75+
evaluations_to_spend=25,
7676
# no optimizer specified
7777
)
7878
```
@@ -87,7 +87,7 @@ neps.run(
8787
evaluate_pipeline=run_function,
8888
pipeline_space=pipeline_space,
8989
root_directory="results/",
90-
max_evaluations_total=25,
90+
evaluations_to_spend=25,
9191
# optimizer specified, along with an argument
9292
optimizer=neps.algorithms.bayesian_optimization, # or as string: "bayesian_optimization"
9393
)
@@ -104,7 +104,7 @@ neps.run(
104104
evaluate_pipeline=run_function,
105105
pipeline_space=pipeline_space,
106106
root_directory="results/",
107-
max_evaluations_total=25,
107+
evaluations_to_spend=25,
108108
optimizer=("bayesian_optimization", {"initial_design_size": 5})
109109
)
110110
```
@@ -137,7 +137,7 @@ neps.run(
137137
evaluate_pipeline=run_function,
138138
pipeline_space=pipeline_space,
139139
root_directory="results/",
140-
max_evaluations_total=25,
140+
evaluations_to_spend=25,
141141
optimizer=MyOptimizer,
142142
)
143143
```

0 commit comments

Comments
 (0)