Skip to content

Commit

Permalink
fix review comments (renames, docstrings)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkirgizov committed Sep 5, 2022
1 parent f1324bd commit f0f8467
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fedot/core/optimisers/gp_comp/gp_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self,
self._graph_depth = AdaptiveGraphDepth(self.generations,
start_depth=requirements.start_depth,
max_depth=requirements.max_depth,
stagnation_threshold=requirements.adaptive_depth_max_stagnation,
max_stagnation_gens=requirements.adaptive_depth_max_stagnation,
adaptive=requirements.adaptive_depth)

# Define initial parameters
Expand Down
7 changes: 4 additions & 3 deletions fedot/core/optimisers/gp_comp/parameters/graph_depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ class AdaptiveGraphDepth(AdaptiveParameter[int]):
Can also play a role of static value if :param adaptive: is False."""

def __init__(self, improvements: ImprovementWatcher,
start_depth: int = 1, max_depth: int = 10, stagnation_threshold: int = 1,
start_depth: int = 1, max_depth: int = 10,
max_stagnation_gens: int = 1,
adaptive: bool = True):
self._improvements = improvements
self._start_depth = start_depth
self._max_depth = max_depth
self._current_depth = start_depth
self._stagnation_threshold = stagnation_threshold
self._max_stagnation_gens = max_stagnation_gens
self._adaptive = adaptive

@property
Expand All @@ -29,6 +30,6 @@ def next(self, population: PopulationT = None) -> int:
return self._max_depth
if self._current_depth >= self._max_depth:
return self._current_depth
if self._improvements.stagnation_duration >= self._stagnation_threshold:
if self._improvements.stagnation_duration >= self._max_stagnation_gens:
self._current_depth += 1
return self._current_depth
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class MutationStrengthEnum(Enum):

@dataclass
class PipelineComposerRequirements(ComposerRequirements):
"""Defines algorithm-specific parameters of evolutionary optimizer.
"""Parameters of evolutionary optimizer that define features of the evolutionary algorithm
and restrictions on the graph composition process.
Evolutionary optimization options
:param crossover_prob: crossover probability (the chance that two chromosomes exchange some of their parts)
Expand Down

0 comments on commit f0f8467

Please sign in to comment.