Skip to content

docs: Update Documentation #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
449dbfd
Refactor evaluation function and update documentation
Meganton Apr 26, 2025
d4aa7f2
chore: remove YAML configuration section from documentation
Meganton Apr 26, 2025
fb8533c
fix: correct typos and formatting in documentation for re-running fai…
Meganton Apr 26, 2025
8b03129
fix: update documentation to remove reference to YAML file in pipelin…
Meganton Apr 26, 2025
a21c4fd
chore: remove YAML configuration section from pipeline space document…
Meganton Apr 26, 2025
2a4c42c
fix: update documentation to clarify usage of priors in NePS algorithms
Meganton Apr 26, 2025
161b048
chore: remove reference to declarative usage documentation from navig…
Meganton Apr 26, 2025
49bbc40
fix: correct function name and improve clarity in evaluate_pipeline d…
Meganton Apr 26, 2025
0c2bbc1
fix: update documentation to reflect changes in output file structure…
Meganton Apr 26, 2025
f39eca1
chore: remove declarative usage examples and configuration files from…
Meganton Apr 26, 2025
0bffeb0
fix: correct spelling of 'evaluate_pipeline' in usage instructions
Meganton Apr 27, 2025
94d2efc
style: format code for consistency and readability
Meganton Apr 27, 2025
9f313fb
fix: correct spelling of 'evalute_pipeline' to 'evaluate_pipeline' in…
Meganton Apr 27, 2025
7ebe43f
fix: correct .gitignore entry for MNIST example data directory
Meganton Apr 27, 2025
8c98e33
fix: correct spelling of 'thourghout' to 'throughout' and update scri…
Meganton Apr 27, 2025
5ce3748
fix: update evaluate_pipeline to write pipeline info to info_file.txt
Meganton Apr 27, 2025
c8c1177
fix: remove unused imports from hyperparameters and multi_fidelity sc…
Meganton Apr 27, 2025
e28538a
fix: add reference to working_directory_per_pipeline example in evalu…
Meganton Apr 27, 2025
14e7668
fix: remove unused import from pytorch_lightning_ddp script and clean…
Meganton Apr 27, 2025
9b7466e
fix: update .gitignore to include lightning_logs and specify data dir…
Meganton Apr 27, 2025
8929d5f
fix: add logging import and return val_loss as item in evaluate_pipeline
Meganton Apr 27, 2025
5079384
fix: remove unused imports and clean up whitespace in efficiency scripts
Meganton Apr 27, 2025
b122fa7
fix: update data paths in MNIST tutorial to use relative directory st…
Meganton Apr 27, 2025
2f9e573
fix: update directory paths from debug to results for ifbo-mnist
Meganton Apr 27, 2025
ca428ee
fix: update dataset paths and improve data loading in image segmentat…
Meganton Apr 27, 2025
31b4613
fix: reorder sections in README for clarity and improve example descr…
Meganton Apr 27, 2025
07b330c
fix: update example headers to improve clarity and consistency regard…
Meganton Apr 30, 2025
f0ff1a9
fix: clarify practical tips for IfBO usage in Multi-Fidelity section
Meganton May 1, 2025
2e60541
fix: enhance practical tips for IfBO usage by including checkpointing…
Meganton May 1, 2025
78470ba
fix: improve documentation clarity in getting started and examples an…
Meganton May 1, 2025
dad8215
fix: update links and references in documentation for clarity and acc…
Meganton May 1, 2025
43dd070
fix: improve documentation formatting in UserResult class docstring
Meganton May 1, 2025
6c8663b
fix: update optimizer documentation for clarity and accuracy in algor…
Meganton May 1, 2025
a501613
fix: add implementation details links for Multi-Fidelity and Prior op…
Meganton May 2, 2025
4063dd9
fix: update algorithm references in documentation for accuracy
Meganton May 2, 2025
ebe8339
fix: replace deprecated PNG image with new JPG image for validation l…
Meganton May 2, 2025
8ba5f41
fix: update validation loss curves image format from PNG to JPG
Meganton May 2, 2025
64f3d41
Merge branch 'master' into docs_update_code
Meganton May 2, 2025
f8adf4f
feat: add seeding documentation and link in navigation
Meganton May 6, 2025
f3837fd
fix: update algorithm support indicators and add links to API documen…
Meganton May 12, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ results
neps_examples/results
tests_tmpdir
usage_example
lightning_logs

# Regression tests
!losses.json
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 0 additions & 26 deletions docs/doc_images/optimizers/venn_dia.svg

This file was deleted.

13 changes: 6 additions & 7 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,22 @@ neps.run(evaluate_pipeline, pipeline_space)

The [reference](reference/neps_run.md) section provides detailed information on the individual components of NePS.

1. How to use the **[`neps.run()` function](reference/neps_run.md)** to start the optimization process.
1. How to use the [**`neps.run()`** function](reference/neps_run.md) to start the optimization process.
2. The different [search space](reference/pipeline_space.md) options available.
3. How to choose and configure the [optimizer](reference/optimizers.md) used.
4. [Declarative usage](reference/declarative_usage.md) of NePS via YAML configuration files.
5. How to define the [`evaluate_pipeline()` function](reference/evaluate_pipeline.md).
6. How to use the [CLI](reference/cli.md) to run NePS from the command line.
7. How to [analyze](reference/analyse.md) the optimization runs.
4. How to define the [`evaluate_pipeline()` function](reference/evaluate_pipeline.md).
5. How to use the [CLI](reference/cli.md) to run NePS from the command line.
6. How to [analyze](reference/analyse.md) the optimization runs.

Or discover the features of NePS through these practical examples:

* **[Hyperparameter Optimization (HPO)](examples/template/basic.md)**:
* **[Hyperparameter Optimization (HPO)](examples/basic_usage/hyperparameters.md)**:
Learn the essentials of hyperparameter optimization with NePS.

* **[Multi-Fidelity Optimization](examples/efficiency/multi_fidelity.md)**:
Understand how to leverage multi-fidelity optimization for efficient model tuning.

* **[Utilizing Expert Priors for Hyperparameters](examples/template/priorband.md)**:
* **[Utilizing Expert Priors for Hyperparameters](examples/efficiency/expert_priors_for_hyperparameters.md)**:
Learn how to incorporate expert priors for more efficient hyperparameter selection.

* **[Additional NePS Examples](examples/index.md)**:
Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ pip install neural-pipeline-search

Using `neps` always follows the same pattern:

1. Define a `evalute_pipeline` function capable of evaluating different architectural and/or hyperparameter configurations
1. Define a `evaluate_pipeline` function capable of evaluating different architectural and/or hyperparameter configurations
for your problem.
1. Define a search space named `pipeline_space` of those Parameters e.g. via a dictionary
1. Call `neps.run` to optimize `evalute_pipeline` over `pipeline_space`
1. Call `neps.run` to optimize `evaluate_pipeline` over `pipeline_space`

In code, the usage pattern can look like this:

Expand All @@ -59,7 +59,7 @@ import logging


# 1. Define a function that accepts hyperparameters and computes the validation error
def evalute_pipeline(
def evaluate_pipeline(
hyperparameter_a: float, hyperparameter_b: int, architecture_parameter: str
) -> dict:
# Create your model
Expand All @@ -72,7 +72,7 @@ def evalute_pipeline(
return validation_error


# 2. Define a search space of parameters; use the same parameter names as in evalute_pipeline
# 2. Define a search space of parameters; use the same parameter names as in evaluate_pipeline
pipeline_space = dict(
hyperparameter_a=neps.Float(
lower=0.001, upper=0.1, log=True # The search space is sampled in log space
Expand All @@ -84,7 +84,7 @@ pipeline_space = dict(
# 3. Run the NePS optimization
logging.basicConfig(level=logging.INFO)
neps.run(
evalute_pipeline=evalute_pipeline,
evaluate_pipeline=evaluate_pipeline,
pipeline_space=pipeline_space,
root_directory="path/to/save/results", # Replace with the actual path.
max_evaluations_total=100,
Expand Down
27 changes: 13 additions & 14 deletions docs/reference/analyse.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ NePS will also generate a summary CSV file for you.
│ └── config_1
│ ├── config.yaml
│ ├── metadata.yaml
│ └── result.yaml
├── summary_csv
│ ├── config_data.csv
│ └── run_status.csv
├── all_losses_and_configs.txt
├── best_loss_trajectory.txt
└── best_loss_with_config_trajectory.txt
│ └── report.yaml
├── summary
│ ├── full.csv
│ └── short.csv
├── optimizer_info.yaml
└── optimizer_state.pkl
```


Expand All @@ -69,17 +68,17 @@ NePS will also generate a summary CSV file for you.
│ └── config_1
│ ├── config.yaml
│ ├── metadata.yaml
│ └── result.yaml
├── all_losses_and_configs.txt
├── best_loss_trajectory.txt
└── best_loss_with_config_trajectory.txt
│ └── report.yaml
├── optimizer_info.yaml
└── optimizer_state.pkl
```


The `config_data.csv` contains all configuration details in CSV format, ordered by ascending `loss`.
Details include configuration hyperparameters, any returned result from the `evalute_pipeline` function, and metadata information.
The `full.csv` contains all configuration details in CSV format.
Details include configuration hyperparameters and any returned result and cost from the `evaluate_pipeline` function.

The `run_status.csv` provides general run details, such as the number of sampled configs, best configs, number of failed configs, best loss, etc.
The `run_status.csv` provides general run details, such as the number of failed and successful configurations,
and the best configuration with its corresponding objective value.

# TensorBoard Integration

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ Executes the optimization based on the provided configuration. This command serv
- `--evaluate-pipeline` (Optional): Optional: Provide the path to a Python file and a function name separated by a colon, e.g., 'path/to/module.py:function_name'. If provided, it overrides the evaluate_pipeline setting from the YAML configuration.
- `--pipeline-space` (Optional): Path to the YAML file defining the search space for the optimization. This can be provided here or defined within the 'run_args' YAML file.
- `--root-directory` (Optional): The directory to save progress to. This is also used to synchronize multiple calls for parallelization.
- `--overwrite-working-directory` (Optional): If set, deletes the working directory at the start of the run. This is useful, for example, when debugging a evalute_pipeline function.
- `--overwrite-working-directory` (Optional): If set, deletes the working directory at the start of the run. This is useful, for example, when debugging a evaluate_pipeline function.
- `--post-run-summary` (Optional): Provide a summary of the results after running.
- `--no-post-run-summary` (Optional): Do not provide a summary of the results after running.
- `--max-evaluations-total` (Optional): Total number of evaluations to run.
- `--max-evaluations-per-run` (Optional): Number of evaluations a specific call should maximally do.
- `--continue-until-max-evaluation-completed` (Optional): If set, only stop after max-evaluations-total have been completed. This is only relevant in the parallel setting.
- `--max-cost-total` (Optional): No new evaluations will start when this cost is exceeded. Requires returning a cost
in the evalute_pipeline function.
in the evaluate_pipeline function.
- `--ignore-errors` (Optional): If set, ignore errors during the optimization process.
- `--loss-value-on-error` (Optional): Loss value to assume on error.
- `--cost-value-on-error` (Optional): Cost value to assume on error.
Expand Down
148 changes: 0 additions & 148 deletions docs/reference/declarative_usage.md

This file was deleted.

20 changes: 10 additions & 10 deletions docs/reference/evaluate_pipeline.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The run function
# The evaluate function

## Introduction

Expand Down Expand Up @@ -108,39 +108,39 @@ Each evaluation carries a cost of 2. Hence in this example, the Bayesian optimiz

NePS also provides the `pipeline_directory` and the `previous_pipeline_directory` as arguments in the `evaluate_pipeline=` function for user convenience.

Regard an example to be run with a multi-fidelity optimizer, some checkpointing would be advantageos such that one does not have to train the configuration from scratch when the configuration qualifies to higher fidelity brackets.
Regard an example to be run with a multi-fidelity optimizer, some checkpointing would be advantageous such that one does not have to train the configuration from scratch when the configuration qualifies to higher fidelity brackets.

```python
def evaluate_pipeline(
pipeline_directory, # The directory where the config is saved
previous_pipeline_directory, # The directory of the immediate lower fidelity config
**config, # The hyperparameters to be used in the pipeline
):
# Assume element3 is our fidelity element
# Assume the third element is our fidelity element
element_1 = config["element_1"]
element_2 = config["element_2"]
element_3 = config["element_3"]
fidelity = config["fidelity"]

# Load any saved checkpoints
checkpoint_name = "checkpoint.pth"
start_element_3 = 0
start_fidelity = 0

if previous_pipeline_directory is not None:
# Read in state of the model after the previous fidelity rung
checkpoint = torch.load(previous_pipeline_directory / checkpoint_name)
prev_element_3 = checkpoint["element_3"]
prev_fidelity = checkpoint["fidelity"]
else:
prev_element_3 = 0
prev_fidelity = 0

start_element_3 += prev_element_3
start_fidelity += prev_fidelity

loss = 0
for i in range(start_element_3, element_3):
for i in range(start_fidelity, fidelity):
loss += element_1 - element_2

torch.save(
{
"element_3": element_3,
"fidelity": fidelity,
},
pipeline_directory / checkpoint_name,
)
Expand Down
Loading