Parameter classes
- class golem.core.optimisers.optimizer.AlgorithmParameters(multi_objective: bool = False, offspring_rate: float = 0.5, pop_size: int = 20, max_pop_size: Optional[int] = 55, adaptive_depth: bool = False, adaptive_depth_max_stagnation: int = 3, structural_diversity_frequency_check: int = 5)[source]
Bases:
objectBase class for definition of optimizers-specific parameters. Can be extended for custom optimizers.
- Parameters
multi_objective – defines if the optimizer must be multi-criterial
offspring_rate – offspring rate used on next population
pop_size – initial population size
max_pop_size – maximum population size; optional, if unspecified, then population size is unbound
adaptive_depth – flag to enable adaptive configuration of graph depth
adaptive_depth_max_stagnation – max number of stagnating populations before adaptive depth increment
- multi_objective: bool = False
- offspring_rate: float = 0.5
- pop_size: int = 20
- max_pop_size: Optional[int] = 55
- adaptive_depth: bool = False
- adaptive_depth_max_stagnation: int = 3
- structural_diversity_frequency_check: int = 5
- class golem.core.optimisers.optimization_parameters.OptimizationParameters(num_of_generations: Optional[int] = None, timeout: Optional[datetime.timedelta] = datetime.timedelta(seconds=300), early_stopping_iterations: Optional[int] = 50, early_stopping_timeout: Optional[float] = 5, keep_n_best: int = 1, max_graph_fit_time: Optional[datetime.timedelta] = None, n_jobs: int = 1, show_progress: bool = True, collect_intermediate_metric: bool = False, parallelization_mode: str = 'populational', static_individual_metadata: dict = <factory>, keep_history: bool = True, history_dir: Optional[str] = <factory>)[source]
Bases:
objectDefines general algorithm-independent parameters of the composition process (like stop condition, validation, timeout, logging etc.)
Options related to stop condition:
- Parameters
num_of_generations – maximum number of optimizer generations
timeout – max time in minutes available for composition process
early_stopping_iterations –
for early stopping.
Optional max number of stagnating iterations for early stopping. If both early_stopping options are None, then do not use early stopping.
early_stopping_timeout –
for early stopping.
Optional duration (in minutes) of stagnating optimization for early stopping. If both early_stopping options are None, then do not use early stopping.
Infrastructure options (logging, performance)
- Parameters
keep_n_best – number of the best individuals of previous generation to keep in next generation
max_graph_fit_time – time constraint for evaluation of each graph (datetime.timedelta)
n_jobs – num of n_jobs
show_progress – bool indicating whether to show progress using tqdm or not
collect_intermediate_metric – save metrics for intermediate (non-root) nodes in graph
parallelization_mode – identifies the way to parallelize population evaluation
History options:
- Parameters
keep_history – if True, then save generations to history; if False, don’t keep history.
history_dir –
directory for saving optimization history, optional.
If the path is relative, then save relative to default_data_dir. If absolute – then save directly by specified path. If None – do not save the history to disk and keep it only in-memory.
- num_of_generations: Optional[int] = None
- timeout: Optional[datetime.timedelta] = datetime.timedelta(seconds=300)
- early_stopping_iterations: Optional[int] = 50
- early_stopping_timeout: Optional[float] = 5
- keep_n_best: int = 1
- max_graph_fit_time: Optional[datetime.timedelta] = None
- n_jobs: int = 1
- show_progress: bool = True
- collect_intermediate_metric: bool = False
- parallelization_mode: str = 'populational'
- static_individual_metadata: dict
- keep_history: bool = True
- history_dir: Optional[str]
- class golem.core.optimisers.optimization_parameters.GraphRequirements(num_of_generations: Optional[int] = None, timeout: Optional[datetime.timedelta] = datetime.timedelta(seconds=300), early_stopping_iterations: Optional[int] = 50, early_stopping_timeout: Optional[float] = 5, keep_n_best: int = 1, max_graph_fit_time: Optional[datetime.timedelta] = None, n_jobs: int = 1, show_progress: bool = True, collect_intermediate_metric: bool = False, parallelization_mode: str = 'populational', static_individual_metadata: dict = <factory>, keep_history: bool = True, history_dir: Optional[str] = <factory>, start_depth: int = 3, max_depth: int = 10, min_arity: int = 2, max_arity: int = 4)[source]
Bases:
golem.core.optimisers.optimization_parameters.OptimizationParametersDefines restrictions and requirements on final graphs.
Restrictions on final graphs:
- Parameters
start_depth – start value of adaptive tree depth
max_depth – max depth of the resulting graph
min_arity – min number of parents for node
max_arity – max number of parents for node
- start_depth: int = 3
- max_depth: int = 10
- min_arity: int = 2
- max_arity: int = 4
- class golem.core.optimisers.optimizer.GraphGenerationParams(adapter: Optional[golem.core.adapter.adapter.BaseOptimizationAdapter] = None, rules_for_constraint: Sequence[Callable[[...], bool]] = (<function has_root>, <function has_no_cycle>, <function has_no_isolated_components>, <function has_no_self_cycled_nodes>, <function has_no_isolated_nodes>), advisor: Optional[golem.core.optimisers.advisor.DefaultChangeAdvisor] = None, node_factory: Optional[golem.core.optimisers.opt_node_factory.OptNodeFactory] = None, random_graph_factory: Optional[Callable[[golem.core.optimisers.optimization_parameters.GraphRequirements, int], golem.core.dag.graph.Graph]] = None, available_node_types: Optional[Sequence[Any]] = None, remote_evaluator: Optional[golem.core.optimisers.genetic.evaluation.DelegateEvaluator] = None)[source]
Bases:
objectThis dataclass is for defining the parameters using in graph generation process
- Parameters
adapter – instance of domain graph adapter for adaptation between domain and optimization graphs
rules_for_constraint – collection of constraints for graph verification
advisor – instance providing task and context-specific advices for graph changes
node_factory – instance for generating new nodes in the process of graph search
remote_evaluator – instance of delegate evaluator for evaluation of graphs
- verifier: golem.core.dag.graph_verifier.GraphVerifier
- advisor: golem.core.optimisers.advisor.DefaultChangeAdvisor
- remote_evaluator: Optional[golem.core.optimisers.genetic.evaluation.DelegateEvaluator] = None
- node_factory: golem.core.optimisers.opt_node_factory.OptNodeFactory
- random_graph_factory: Callable[[golem.core.optimisers.optimization_parameters.GraphRequirements, int], golem.core.dag.graph.Graph]