Skip to content

bayesian

layer_distance

The distance between two layers.

layers_distance

The distance between the layers of two neural networks.

skip_connection_distance

The distance between two skip-connections.

skip_connections_distance

The distance between the skip-connections of two neural networks.

edit_distance

The distance between two neural networks. Args: x: An instance of NetworkDescriptor. y: An instance of NetworkDescriptor

Returns

edit_distance_matrix

Calculate the edit distance.

Args
  • train_x: A list of neural architectures.

  • train_y: A list of neural architectures.

Returns

vector_distance

The Euclidean distance between two vectors.

bourgain_embedding_matrix

Use Bourgain algorithm to embed the neural architectures based on their edit-distance.

Args
  • distance_matrix: A matrix of edit-distances.
Returns

contain

Check if the target descriptor is in the descriptors.

IncrementalGaussianProcess

Gaussian process regressor.

Attributes
  • alpha: A hyperparameter.

fit

Fit the regressor with more data.

Args
  • train_x: A list of NetworkDescriptor.

  • train_y: A list of metric values.

incremental_fit

Incrementally fit the regressor.

first_fit

Fit the regressor for the first time.

predict

Predict the result.

Args
  • train_x: A list of NetworkDescriptor.
Returns
  • y_mean: The predicted mean.

  • y_std: The predicted standard deviation.

BayesianOptimizer

A Bayesian optimizer for neural architectures.

Attributes
  • searcher: The Searcher which is calling the Bayesian optimizer.

  • t_min: The minimum temperature for simulated annealing.

  • metric: An instance of the Metric subclasses.

  • gpr: A GaussianProcessRegressor for bayesian optimization.

  • beta: The beta in acquisition function. (refer to our paper)

  • search_tree: The network morphism search tree.

fit

Fit the optimizer with new architectures and performances.

Args
  • x_queue: A list of NetworkDescriptor.

  • y_queue: A list of metric values.

generate

Generate new architecture.

Args
  • descriptors: All the searched neural architectures.

  • timeout: An integer. The time limit in seconds.

  • sync_message: the Queue for multiprocessing return value.

Returns
  • graph: An instance of Graph. A morphed neural network with weights.

  • father_id: The father node ID in the search tree.

Elem

Elements to be sorted according to metric value.

ReverseElem

Elements to be reversely sorted according to metric value.

SearchTree

The network morphism search tree.

get_dict

A recursive function to return the content of the tree in a dict.