Skip to content
Open
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
6 changes: 3 additions & 3 deletions docs/doc_benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ Furthermore, the user can declare:
- `startseed`: creates reproducible results (mandatory)
- `endseed`: creates reproducible results (mandatory)
- `mode`: set to `grid` to apply grid search for hyperparameter sampling (optional, for details see next section)
- `Shared params`: an optional list including the shared hyperparameters with respective sampling distribution
(mandatory if Shared params should be used) and in case of random sampling `num_shared_param_samples`
- `commonHyperpars2sample`: an optional list including the shared hyperparameters with respective sampling distribution
(mandatory if shared parameters should be used) and in case of random sampling `num_shared_param_samples`
(number of samples for the shared hyperparameters, mandatory for random sampling)

Depending on which hyperparameter sampling technique is used (see section below), the user must also
Expand All @@ -140,7 +140,7 @@ respect/declare the following:
- `step`: "step-size" (float) between samples. Only points being a multiple of the step-size apart
can be sampled. `0` means that each real number can be sampled.
- `num_shared_param_samples`: number of samples for the shared hyperparameters. Must be defined
inside the Shared params section (if this section is used)
inside the commonHyperpars2sample section (if this section is used)
- grid search hyperparameter sampling (`mode`:`grid`):
- `num`: number of hyperparameters to be sampled (int) must be specified for each hyperparameter
(mandatory)
Expand Down
8 changes: 4 additions & 4 deletions docs/doc_benchmark_yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ domainlab_args:
###################################################################################
# Hyperparameters which appear in multiple tasks can e shared among these tasks.
# Hence for each task the same random sampled hyperparameters are used
Shared params:
commonHyperpars2sample:
#### For random sampling #####
# number of shared samples to be created.
# The sampling procedure creates a set of randomly sampled shared samples,
Expand Down Expand Up @@ -155,7 +155,7 @@ Task_Dann:

There are two possible ways of choosing your hyperparameters for the benchmark in domainlab, rand sampling and grid search. The decision about which method to use was already done in the previous section be either setting `num_param_samples` (for random sampling) or `mode: grid` (for gridsearch).

For filling in the sampling description for the into the `Shared params` and the `hyperparameter` section you have the following options:
For filling in the sampling description for the into the `commonHyperpars2sample` and the `hyperparameter` section you have the following options:

### uniform and loguniform distribution
1. uniform samples in the interval [min, max]
Expand Down Expand Up @@ -252,7 +252,7 @@ Task_Name:
aname: ...
...

# specify sections from the Shared params section
# specify sections from the commonHyperpars2sample section
shared:
- ...
# specify task specific hyperparameter sampling
Expand Down Expand Up @@ -283,7 +283,7 @@ Task_Name:
aname: ...
...

# specify sections from the Shared params section
# specify sections from the commonHyperpars2sample section
shared:
- ...
# add the constraints as a standalone section to the task
Expand Down
4 changes: 2 additions & 2 deletions domainlab/utils/hyperparameter_gridsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ def sample_gridsearch(config: dict,
samples = pd.DataFrame(columns=['task', 'algo', 'params'])
shared_samples_full = pd.DataFrame(columns=['task', 'algo', 'params'])

if 'Shared params' in config.keys():
shared_val = {'aname': 'all', 'hyperparameters': config['Shared params']}
if 'commonHyperpars2sample' in config.keys():
shared_val = {'aname': 'all', 'hyperparameters': config['commonHyperpars2sample']}
# fill up the dataframe shared samples
shared_samples_full = grid_task(shared_samples_full, 'all', shared_val, None)
else:
Expand Down
6 changes: 3 additions & 3 deletions domainlab/utils/hyperparameter_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ def sample_hyperparameters(config: dict,

num_samples = config['num_param_samples']
samples = pd.DataFrame(columns=['task', 'algo', 'params'])
shared_config_full = config['Shared params']
shared_config_full = config['commonHyperpars2sample']
shared_samples_full = pd.DataFrame(columns=['task', 'algo', 'params'])
if 'Shared params' in config.keys():
shared_val = {'aname': 'all', 'hyperparameters': config['Shared params']}
if 'commonHyperpars2sample' in config.keys():
shared_val = {'aname': 'all', 'hyperparameters': config['commonHyperpars2sample']}
# fill up the dataframe shared samples
shared_samples_full = sample_task(shared_config_full['num_shared_param_samples'],
'all', (shared_val, shared_samples_full), (None, None))
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/benchmark_mnist_shared_hyper_grid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ startseed: 0
endseed: 2 # currently included


Shared params:
commonHyperpars2sample:
zy_dim:
min: 32
max: 96
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/benchmark_pacs_resnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ domainlab_args:
npath_encoder_sandwich_layer_img2h4zd: examples/nets/resnet50domainbed.py
san_check: True

Shared params:
commonHyperpars2sample:
num_shared_param_samples: 8
gamma_y:
min: 1e4
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/benchmark_pacs_resnet_on_mnist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ domainlab_args:
nname_encoder_sandwich_layer_img2h4zd: conv_bn_pool_2
san_check: True

Shared params:
commonHyperpars2sample:
num_shared_param_samples: 8

lr:
Expand Down
2 changes: 1 addition & 1 deletion examples/yaml/demo_hyperparameter_gridsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
output_dir: "zoutput/benchmarks/hyperparameter_grid_test"
mode: grid

Shared params:
commonHyperpars2sample:
p1_shared:
distribution: uniform
min: 1
Expand Down
2 changes: 1 addition & 1 deletion examples/yaml/demo_hyperparameter_sampling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ output_dir: "zoutput/benchmarks/hyperparameter_test"
num_param_samples: 30


Shared params:
commonHyperpars2sample:
num_shared_param_samples: 5
p1_shared:
distribution: uniform
Expand Down