Usage#
The top-level entry point of the framework is the HiveNAS class.
Examples#
The simplest way to run HiveNAS is to use the default parameters (which are empirically optimized for simple image-classification tasks) as follows:
python HiveNAS.py --verbose
To specify a custom configuration file (see Configuration), use the -c | --config-file argument:
python HiveNAS.py --verbose -c="path/to/config.yaml"
To import the top-level module into an existing project:
from HiveNAS import HiveNAS
HiveNAS.find_topology()
All primitive, non-iterable operational parameters (i.e int, float, bool, str) are defined as CLI arguments. Find more customizable use cases below.
Advanced Usage#
To run HiveNAS over the MNIST benchmark, specify a unique configuration version name and the dataset:
python HiveNAS.py --verbose -cv="mnist-trial" -oo="NAS" -ds="MNIST"
The same setting over the FashionMNIST benchmark can be ran as follows:
python HiveNAS.py --verbose -cv="fashion-mnist-trial" -oo="NAS" -ds="FASHION_MNIST"
To experiment with Artificial Bee Colony and Numerical Benchmarks (Rosenbrock optimization, for instance), the -oo flag (or --optimization-objective) can be specified.
python HiveNAS.py --verbose -cv="rosenbrock-trial" -oo="Rosenbrock"
CLI Arguments#
To override any of the default parameters, refer to the table below (or use the -h / --help argument):
Configuration Parameter |
Argument Name |
Argument Flag |
|---|---|---|
CONFIG_VERSION |
|
|
SEED_VALUE |
|
|
OPTIMIZATION_OBJECTIVE |
|
|
ABANDONMENT_LIMIT |
|
|
COLONY_SIZE |
|
|
EMPLOYEE_ONLOOKER_RATIO |
|
|
ITERATIONS_COUNT |
|
|
RESULTS_SAVE_FREQUENCY |
|
|
RESULTS_BASE_PATH |
|
|
HISTORY_FILES_SUBPATH |
|
|
ENABLE_WEIGHT_SAVING |
|
|
WEIGHT_FILES_SUBPATH |
|
|
RESUME_FROM_RESULTS_FILE |
|
|
DEPTH |
|
|
STOCHASTIC_SC_RATE |
|
|
DATASET |
|
|
EPOCHS |
|
|
MOMENTUM_EPOCHS |
|
|
FULL_TRAIN_EPOCHS |
|
|
TERMINATION_THRESHOLD_FACTOR |
|
|
TERMINATION_DIMINISHING_FACTOR |
|
|
INITIAL_LR |
|
|
FINAL_LR |
|
|
BATCH_SIZE |
|
|
AFFINE_TRANSFORMATIONS_ENABLED |
|
|
CUTOUT_PROB |
|
|
SATURATION_AUG_PROB |
|
|
CONTRAST_AUG_PROB |
|
|
Alternative Datasets#
In addition to the predefined datasets, virtually any labeled type of data can be used by defining a custom loader in NASEval's initializer.
Note
Ensure that the input data (i.e (X_train, X_test)) have a 4-dimensional shape, matching Keras’ CIFAR10 . If the data has less channels, consider adding placeholders as demonstrated in NASEval with MNIST/FashionMNIST (X_train.reshape(-1,28,28,1))
HiveNAS currently supports CNNs only, with plans to expand to RNNs in the future.