Skip to content

Commit

Permalink
Documentation iteration + minor tblogger example change
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekAbouChakra committed Feb 12, 2024
1 parent 903d6cf commit e605256
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 10 deletions.
36 changes: 29 additions & 7 deletions docs/analyse.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@ ROOT_DIRECTORY
├── best_loss_trajectory.txt
└── best_loss_with_config_trajectory.txt
```
## Summary CSV

The argument `post_run_summary` in `neps.run` allows for the automatic generation of CSV files after a run is complete. The new root directory after utilizing this argument will look like the following:

```
ROOT_DIRECTORY
├── results
│ └── 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
```

- *`config_data.csv`*: Contains all configuration details in CSV format, ordered by ascending `loss`. Details include configuration hyperparameters, any returned result from the `run_pipeline` function, and metadata information.

- *`run_status.csv`*: Provides general run details, such as the number of sampled configs, best configs, number of failed configs, best loss, etc.

## TensorBoard Integration

Expand All @@ -37,19 +59,19 @@ The `tblogger.log` function is invoked within the model's training loop to facil
tblogger.log(
loss: float,
current_epoch: int,
write_summary_incumbent: bool = False,
write_config_scalar: bool = False,
write_config_hparam: bool = True,
write_summary_incumbent: bool = False,
extra_data: dict | None = None
)
```

- **Parameters:**
- `loss` (float): The loss value to be logged.
- `current_epoch` (int): The current epoch or iteration number.
- `write_summary_incumbent` (bool, optional): Set to `True` for a live incumbent trajectory.
- `write_config_scalar` (bool, optional): Set to `True` for a live loss trajectory for each configuration.
- `write_config_hparam` (bool, optional): Set to `True` for live parallel coordinate, scatter plot matrix, and table view.
- `write_summary_incumbent` (bool, optional): Set to `True` for a live incumbent trajectory.
- `extra_data` (dict, optional): Additional data to be logged, provided as a dictionary.

### Extra Custom Logging
Expand Down Expand Up @@ -104,15 +126,15 @@ You can find this example [here](https://github.com/automl/neps/blob/master/neps
!!! info "Important"
We have optimized the example for computational efficiency. If you wish to replicate the exact results showcased in the following section, we recommend the following modifications:

1- Increase maximum epochs [here](https://github.com/automl/neps/blob/master/neps_examples/convenience/neps_tblogger_tutorial.py#L260) from 2 to 10
1- Increase maximum epochs from 2 to 10

2- Set the `write_summary_incumbent` argument [here](https://github.com/automl/neps/blob/master/neps_examples/convenience/neps_tblogger_tutorial.py#L300) to `True`
2- Set the `write_summary_incumbent` argument to `True`

3- Change the searcher [here](https://github.com/automl/neps/blob/master/neps_examples/convenience/neps_tblogger_tutorial.py#L357) from `random_search` to `bayesian_optimization`
3- Change the searcher from `random_search` to `bayesian_optimization`

4- Increase the maximum evaluations [here](https://github.com/automl/neps/blob/master/neps_examples/convenience/neps_tblogger_tutorial.py#L362) from 2 to 14
4- Increase the maximum evaluations before disabling `tblogger` from 2 to 14

5- Increase the maximum evaluations [here](https://github.com/automl/neps/blob/master/neps_examples/convenience/neps_tblogger_tutorial.py#L391) from 3 to 15
5- Increase the maximum evaluations after disabling `tblogger` from 3 to 15

### Visualization Results

Expand Down
Binary file modified docs/doc_images/tensorboard/tblogger_hparam1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/doc_images/tensorboard/tblogger_hparam2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/doc_images/tensorboard/tblogger_hparam3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/doc_images/tensorboard/tblogger_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/doc_images/tensorboard/tblogger_scalar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions neps/plot/tensorboard_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,12 @@ def log(
loss (float): Current loss value.
current_epoch (int): Current epoch of the experiment
(used as the global step).
writer_scalar (bool, optional): Displaying the loss or accuracy
writer_config_scalar (bool, optional): Displaying the loss or accuracy
curve on tensorboard (default: True)
writer_hparam (bool, optional): Write hyperparameters logging of
writer_config_hparam (bool, optional): Write hyperparameters logging of
the configs (default: True).
write_summary_incumbent (bool, optional): Set to `True` for a live
incumbent trajectory.
extra_data (dict, optional): Additional experiment data for logging.
"""
if tblogger.disable_logging:
Expand Down
2 changes: 1 addition & 1 deletion neps_examples/convenience/neps_tblogger_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def run_pipeline(lr, optim, weight_decay):
run_args = dict(
run_pipeline=run_pipeline,
pipeline_space=pipeline_space(),
root_directory="output",
root_directory="results/neps_tblogger_example",
searcher="random_search",
)

Expand Down

0 comments on commit e605256

Please sign in to comment.