Search Space#

(hivenas.core.nas.search_space)

The Search Space phase of the NAS framework.

class NASSearchSpace(config)[source]#

Bases: object

Defines the Search Space used to sample candidates by HiveNAS

all_paths#

a list of all Directed Acyclic sub-Graphs in the search space (i.e all candidates)

Type

list

config#

the predefined operational parameters pertaining to the search space (defined in search_space_config)

Type

dict

dag#

the search space graph (depracated; otf-encoding used at the moment)

Type

DiGraph

compute_space_size()[source]#

Returns the number of possible architectures in the given space (i.e operations and depth) for analytical purposes

Returns

the size of the search space (number of all possible candidates)

Return type

int

eval_format(path)[source]#

Formats a path for evaluation (stripped, decoded, and excluding input/output layers) given a string-encoded path

Parameters

path (str) – string-encoded representation of the architecture

Returns

a list of operations ([str]) representing a model architecture to be used by the evaluation strategy

Return type

list

get_neighbor(path_str)[source]#

Returns a path with 1-op difference (a neighbor).

The definition of a neighbor architecture differs from one model to another in the literature, however, the general consensus is a 1-op difference network [1].

[1] Colin White et al. “How Powerful are Performance Predictors in Neural Architecture Search?” In: Advances in Neural Information Processing Systems 34 (2021).

Parameters

path_str (str) – string-encoded representation of the architecture

Returns

string-encoded representation of a neighbor architecture

Return type

str

sample()[source]#

Samples a random point (i.e a candidate architecture) from the search space

Returns

string-encoded representation of the architecture

Return type

str