Configuration#


Framework Customization#

HiveNAS has a flexible and configurable design to fit a wider range of task contexts. Below is the list of all operational parameters, their descriptions, and default values.

Custom YAML tags are defined within the framework to keep track of configurations, as well as provide a readable and user-friendly framework operation.


Allowed YAML Tags#

Configuration files accept two custom YAML tags: !Operation and !!python/tuple [n, m] (following the YAML 2002 specs) to represent \(n \times m\) shapes. The definition of the constructor and representer for each tag is defined in config.params.Params.init_from_yaml and config.params.Params.export_yaml, respectively.


Parameters Table#

In addition to the documentation below, the default configuration file is thoroughly documented and contains all the default values used by the framework.


Parameter Key

Data Type

Parameter Description

CONFIG_VERSION

str

The simulation’s configuration version. This can be considered the experiment’s unique ID and all generated results will be under this configuration name
Note: must be a file-path compatible string.

Default: 'default_config'

SEED_VALUE

int

The framework-wide RNG seed value (used to reproduce results).
Note: -ve values can be used to revert to default randomness.

Default: 42

OPTIMIZATION_OBJECTIVE

str

The objective to be optimized.
Valid options: ['NAS', 'Rosenbrock', 'Sphere_min', 'Sphere_max'].

Default: 'NAS'

ABANDONMENT_LIMIT

int

The ABC optimizer abandonment limit.

Default: 3

COLONY_SIZE

int

Number of Employee and Onlooker bees in the colony. Scouts have a 1-to-1 ratio with Employees (as per the classical ABC implementation).

Default: 7

EMPLOYEE_ONLOOKER_RATIO

float

Employees to Onlookers ratio
i.e \(Employees = Colony * Ratio\)

Default: 0.44

ITERATIONS_COUNT

int

Number of ABC iteractions
Note: this is not the number of training epochs per candidate.

Default: 15

RESULTS_SAVE_FREQUENCY

int

Update the main CSV data file every \(n\) evaluations
Note: (evaluations not iterations i.e ITERATIONS_COUNT \(\times\) ( COLONY_SIZE \(/\) RESULTS_SAVE_FREQUENCY ) \(=\) total saves).

Default: 1

RESULTS_BASE_PATH

str

Base directory path, where a CONFIG_VERSION-named folder is created, storing all generated results.
The path gets recursively created if it does not exist.

Default: './results/'

HISTORY_FILES_SUBPATH

str

Relative sub-path for training history files folder.
The path gets recursively created if it does not exist.

Default: 'training_history/'

ENABLE_WEIGHT_SAVING

bool

Specifies whether or not to save candidate model files.
Note: each model file may take up a large amount of disk space (1-2gb on average). Ensure that enough disk space is available to avoid optimization interruptions.

Default: False

WEIGHT_FILES_SUBPATH

str

Relative sub-path for candidate model files folder(if ENABLE_WEIGHT_SAVING is set to True)
The path gets recursively created if it does not exist.

Default: 'weights/'

RESUME_FROM_RESULTS_FILE

bool

Specifies whether or not to resume training from the main data file (if it exists).
Note: this might affect ABC’s convergence behavior as some internal optimizer settings will be set to default

Default: False

DEPTH

int

The candidate models’ fixed depth (excluding INPUT_STEM and OUTPUT_STEM)

Default: 4

OPERATIONS

dict

A dictionary defining a search_space list (searchable operations) and a reference_space dict (a lookup table for discretized operations/hyperparameters). These along with the DEPTH define the Search Space, and therefore largely influence the performance of the framework.

The search_space / reference_space allow hybrid layer-wise and cell-based operations (by defining a cell in OperationCells and treating it as any Keras layer (see built-in example cells)).

Note: operations in the :code:`reference_space` are defined as partial functions (functools.partial) and can be specified in YAML format using the custom tag !Operation ( see example config file ).

Default: (refer to example file)

STOCHASTIC_SC_RATE

float

Rate at which skip-connections could occur per layer. The depth of the residual block is randomly sampled (bounded between [1, DEPTH - current_layer])
A value of 0.0 disables ResNets, while a value of 1.0 guarantees a skip-connection between all operations.

Default: 0.0

DATASET

str

The optimization problem’s dataset (for OPTIMIZATION_OBJECTIVE = 'NAS').
Valid options: ['CIFAR10', 'MNIST', 'FASHION_MNIST'] . The framework is dataset-agnostic and should function with any other dataset, provided that its loader is defined in NASEval .

Default: 'CIFAR10'

INPUT_STEM

list

A list of operations’ keys defining the static input stem for all candidates.
Note: operations referenced here must be defined in :code:`OPERATIONS.reference_space` (functools.partial) and can be specified in YAML format using the custom tag !Operation ( see example config file ).

Default: (refer to example file)

OUTPUT_STEM

list

A list of operations defining the static output stem for all candidates.
Note: operations referenced here must be defined in :code:`OPERATIONS.reference_space` (functools.partial) and can be specified in YAML format using the custom tag !Operation ( see example config file ).

Default: (refer to example file)

EPOCHS

int

Number of training epochs per candidate.
Note: it is empirically deduced that any number above 10 significantly impacts the NAS convergence process and limits the exploration/exploitation of ABC. A shallow initial search provides a sufficiently good measure of a candidate’s performance.

Default: 5

FULL_TRAIN_EPOCHS

int

Number of training epochs to train the best-performing candidate resulting from the shallow search (used by fully_train_best_model).

Default: 100

INITIAL_LR

float

The initial learning rate used in an ExponentialDecay learning-rate schedule

Note: this parameter overrides the :code:`learning_rate` defined in the :code:`OPTIMIZER` partial. A value of :python:`0.0` disables it
Default: 0.08

FINAL_LR

float

The final learning rate used in an ExponentialDecay learning-rate schedule

Note: this parameter overrides the :code:`learning_rate` defined in the :code:`OPTIMIZER` partial. A value of :python:`0.0` disables it
Default: 0.01

BATCH_SIZE

int

The candidates’ training batch size.

Default: 128

OPTIMIZER

str

The Evaluation Strategy’s optimizer, defined as partial functions (functools.partial)
Included optimizers: Adam, SGD, RMSprop.

Note: define custom optimizers by simply importing them to Params (must be availble in the globals() variable).

Default: partial(SGD, learning_rate=0.08, decay=5e-4, momentum=0.9, nesterov=True)

AFFINE_TRANSFORMATIONS_ENABLE

bool

Enables simple affine transformations (rotation, shift, zoom, sheer, flip – customize in the NASEval class).

Default: True

CUTOUT_PROB

float

Probability of applying cutout augmentation per sample.
A value of 0.0 disables cutout augmentation, while a value of 1.0 guarantees the augmentation for every sample.

Default: 0.5

SATURATION_AUG_PROB

float

Probability of applying saturation augmentation per sample.
A value of 0.0 disables saturation augmentation, while a value of 1.0 guarantees the augmentation for every sample.

Default: 0.75

CONTRAST_AUG_PROB

float

Probability of applying contrast augmentation per sample.
A value of 0.0 disables contrast augmentation, while a value of 1.0 guarantees the augmentation for every sample.

Default: 0.75

MOMENTUM_EPOCH

int

The number of epochs in the Momentum Evaluation pool to be assigned to candidates with a stable convergence profile.
A value of 0 disables Momentum Evaluation.

Default: 0

TERMINATION_THRESHOLD_FACTOR

float

Threshold factor (\(β\)) for ACT (TerminateOnThreshold).
A value of 0.0 disables ACT

Default: 0.25

TERMINATION_DIMINISHING_FACTOR

float

Diminishing factor (\(ζ\)) for ACT (TerminateOnThreshold).

Default: 0.25