Supervisor
Ga_supervisor
- class gaggle.supervisor.ga_supervisor.GASupervisor(ga_name: str = 'simple', population_size: int = 100, num_parents: int = 100, generations: int = 100, problem_name: str = 'MNIST', individual_name: str = 'nn', individual_size: int = 100, device: str = 'cpu', elitism: float = 0.1, crossover: str = 'uniform', k_point: int = 1, tournament_size: int = 3, selection_pressure: float = 0.5, mutation: str = 'normal', mutation_chance: float = 0.01, mutation_std: float = 0.05, use_freshness: bool = True, mutate_protected: bool = False, uniform_mutation_min_val: float = -1.0, uniform_mutation_max_val: float = 1.0, selection: str = 'weighted', parent_survival_rate: float = 0.5, batch_size: int = -1, eval_batch_size: int = -1, save_best_every: int = None, eval_every_generation: int = 50, model_name: str = 'lenet', root: str = './runs', name: str = 'run', seed: int = 1337, steps: int = 1, runs: int = 1, dataset_root: str = 'None', gui: bool = False, display_train_metrics: bool = True, display_test_metrics: bool = True)[source]
Bases:
object
Gives a single-line interface to our framework. At minimum, a user needs to specify which problem they want to solve. Also allows for customization by passing functions or new operators.
- run(*args, **kwargs)[source]
Run the genetic algorithm described during __init__. When running pre-existing problems, if additional parameters need to be passed to the initialization of the PopulationManager, they can be given in *args and **kwargs.
- Parameters:
*args –
**kwargs –
Returns:
- set_custom_fitness(fitness_function: Callable, *args, **kwargs)[source]
If during initialization, problem_name is set to “custom”, then this function needs to be called to setup the fitness function to evaluate the population on before calling self.run(). This takes in any callable that will return a float value of the individual. If custom arguments are necessary, they can be passed as *args and **kwargs and will be used when invoking the fitness_function.
- Parameters:
fitness_function – fitness function to optimize
*args –
**kwargs –
Returns: