Discrete Profile

class confopt.profile.DiscreteProfile(searchspace_type: str | SearchSpaceType, domain: str | None = None, **kwargs: Any)

Bases: object

_initializa_genotype() None

Initializes the genotype for the discrete profile. This method sets the genotype of the best DARTS supernet found after 50 epochs of running the DARTS optimizer. Thus it is only a valid genotype if the search space is of type DARTS.

Parameters:

None

Returns:

None

_initialize_trainer_config() None

Initializes the trainer configuration for the discrete profile. This method sets the default training configuration parameters for the discrete model.

Parameters:

None

Returns:

None

configure_extra(**config: Any) None

Configure any extra settings for the supernet. Could be useful for tracking Weights & Biases metadata.

Parameters:

**config – Arbitrary keyword arguments.

Returns:

None

configure_searchspace(**config: Any) None

Configure the search space for the supernet.

Parameters:

**config – Arbitrary keyword arguments. Possible depend on the the search space type. For more information please check the Parameters of the supernet of each search space.

Returns:

None

configure_trainer(**kwargs) None

Configure the trainer component for the supernet.

Parameters:

**kwargs

Arbitrary keyword arguments. Possible keys include:

lr (float): Learning rate for the optimizer.

epochs (int): Number of training epochs.

optim (str): Optimizer type. Can be ‘sgd’, ‘adam’, etc.

optim_config (dict): Additional configuration for the optimizer.

Raises:

AssertionError – If any of the provided configuration keys are not valid.

Returns:

None

get_extra_config() dict

This method returns the extra configuration parameters for the discrete profile for example could be used for Weights & Biases metadata.

Parameters:

None

Returns:

dict – A dictionary containing extra configuration parameters.

get_genotype() str

Returns the genotype of the discrete profile.

Parameters:

None

Returns:

str – The genotype of the discrete profile.

get_run_description() str

This method returns a string description of the run configuration. The description is used for tracking purposes in Weights & Biases.

Parameters:

None

Returns:

str – A string describing the run configuration.

get_searchspace_config(dataset_str: str) dict

Returns the search space configuration based on the search space type.

Parameters:

dataset_str (str) – The dataset string.

Raises:
  • ValueError – If the search space is not any of the valid values of

  • NasBench201, DARTS, NasBench1Shot1 or TransNasBench101.

Returns:

dict – A dictionary containing the search space configuration which would be passed to as the arguments for creating the new discrete model object.

get_trainer_config() dict

Returns the trainer configuration for the discrete profile.

Parameters:

None

Returns:

dict – A dictionary containing the trainer configuration.

set_search_space_config(config: dict) None

Sets the search space configuration for the discrete profile. This method allows the user to set custom configuration parameters.

Parameters:

config (dict) – A dictionary containing the search space configuration.

Returns:

None