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

--config-version

-cv

SEED_VALUE

--seed-value

-sv

OPTIMIZATION_OBJECTIVE

--optimization-objective

-oo

ABANDONMENT_LIMIT

--abandonment-limit

-al

COLONY_SIZE

--colony-size

-cs

EMPLOYEE_ONLOOKER_RATIO

--employee-onlooker-ratio

-eor

ITERATIONS_COUNT

--iterations-count

-ic

RESULTS_SAVE_FREQUENCY

--results-save-frequency

-rsf

RESULTS_BASE_PATH

--results-base-path

-rbp

HISTORY_FILES_SUBPATH

--history-files-subpath

-hfs

ENABLE_WEIGHT_SAVING

--enable-weight-saving

-ews

WEIGHT_FILES_SUBPATH

--weight-files-subpath

-wfs

RESUME_FROM_RESULTS_FILE

--resume-from-results-file

-rfrf

DEPTH

--depth

-d

STOCHASTIC_SC_RATE

--stochastic-sc-rate

-ssr

DATASET

--dataset

-ds

EPOCHS

--epochs

-e

MOMENTUM_EPOCHS

--momentum-epochs

-me

FULL_TRAIN_EPOCHS

--full-train-epochs

-fte

TERMINATION_THRESHOLD_FACTOR

--termination-threshold-factor

-ttf

TERMINATION_DIMINISHING_FACTOR

--termination-diminishing-factor

-tdf

INITIAL_LR

--initial-lr

-il

FINAL_LR

--final-lr

-fl

BATCH_SIZE

--batch-size

-bs

AFFINE_TRANSFORMATIONS_ENABLED

--affine-transformations-enabled

-ate

CUTOUT_PROB

--cutout-prob

-cp

SATURATION_AUG_PROB

--saturation-aug-prob

-sap

CONTRAST_AUG_PROB

--contrast-aug-prob

-cap

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.