Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fixes #109

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def __init__(
self._crossover_swap_branch,
]


if self.inner_config_dict is not None:
self.mutate_methods_list.append(self._mutate_insert_inner_node)
self.crossover_methods_list.append(self._crossover_take_branch) #this is the only crossover method that can create inner nodes
Expand All @@ -217,7 +218,7 @@ def __init__(
self.mutate_methods_list.append(self._mutate_remove_edge)
self.mutate_methods_list.append(self._mutate_add_edge)

if not linear_pipeline:
if not linear_pipeline and (self.leaf_config_dict is not None or self.inner_config_dict is not None):
self.mutate_methods_list.append(self._mutate_insert_leaf)


Expand Down Expand Up @@ -595,20 +596,12 @@ def _mutate_replace_node(self, rng_=None):
for node in sorted_nodes_list:
if isinstance(node,GraphIndividual):
continue
node.method_class = rng.choice(list(self.select_config_dict(node).keys()))
if isinstance(self.select_config_dict(node)[node.method_class], dict):
hyperparameters = self.select_config_dict(node)[node.method_class]
node.hyperparameters = hyperparameters
else:
#hyperparameters = self.select_config_dict(node)[node.method_class](config.hyperparametersuggestor)
#get_hyperparameter(self.select_config_dict(node)[node.method_class], nodelabel=None, alpha=self.hyperparameter_alpha, hyperparameter_probability=self.hyperparameter_probability)
new_node = create_node(self.select_config_dict(node), rng_=rng)
#TODO cleanup
node.hyperparameters = new_node.hyperparameters
node.method_class = new_node.method_class
node.label = new_node.label

return True
new_node = create_node(self.select_config_dict(node), rng_=rng)
#check if new node and old node are the same
#TODO: add attempts?
if node.method_class != new_node.method_class or node.hyperparameters != new_node.hyperparameters:
nx.relabel_nodes(self.graph, {new_node:node}, copy=False)
return True

return False

Expand Down
Loading