autoaug.autoaugment_learners.GenLearner

class autoaug.autoaugment_learners.GenLearner(num_sub_policies=5, p_bins=11, m_bins=10, exclude_method=[], learning_rate=0.1, max_epochs=inf, early_stop_num=20, batch_size=8, toy_size=1, num_offspring=2)[source]

Genetic Algorithm learner

Parameters
  • num_sub_policies (int, optional) – number of subpolicies per policy. Defaults to 5.

  • p_bins (int, optional) – number of bins we divide the interval [0,1] for probabilities. e.g. (0.0, 0.1, … 1.0) Defaults to 11.

  • m_bins (int, optional) – number of bins we divide the magnitude space. Defaults to 10.

  • exclude_method (list, optional) – list of names(:type:str) of image operations the user wants to exclude from the search space. Defaults to [].

  • learning_rate (float, optional) – child_network training parameter. Defaults to 1e-1.

  • max_epochs (Union[int, float], optional) – child_network training parameter. Defaults to float(‘inf’).

  • early_stop_num (int, optional) – child_network training parameter. Defaults to 20.

  • batch_size (int, optional) – child_network training parameter. Defaults to 32.

  • toy_size (int, optional) – child_network training parameter. ratio of original dataset used in toy dataset. Defaults to 0.1.

  • num_offsprings (int, optional) – Defaults to 1

Examples

from autoaug.autoaugment_learners.GenLearner import GenLearner evo_learner = GenLearner()

learn(train_dataset, test_dataset, child_network_architecture, iterations=100)[source]

Generates policies through a genetic algorithm.

Parameters
  • torchvision.dataset (test_dataset ->) –

  • torchvision.dataset

  • -> (child_network_architecture) –

  • int (iterations ->) – number of iterations to run the instance for