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

Fix crossover #212

Merged
merged 5 commits into from
Oct 19, 2023
Merged

Fix crossover #212

merged 5 commits into from
Oct 19, 2023

Conversation

YamLyubov
Copy link
Collaborator

@YamLyubov YamLyubov commented Oct 9, 2023

Fixes:

  • nx graph adaptation
  • structural_equivalent_nodes

Adds test for evolution with crossover.

#206

@pep8speaks
Copy link

pep8speaks commented Oct 9, 2023

Hello @YamLyubov! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2023-10-10 12:07:12 UTC

@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2023

Codecov Report

Merging #212 (5298ef2) into main (2f2df8d) will decrease coverage by 0.01%.
Report is 4 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #212      +/-   ##
==========================================
- Coverage   73.76%   73.76%   -0.01%     
==========================================
  Files         131      131              
  Lines        7826     7833       +7     
==========================================
+ Hits         5773     5778       +5     
- Misses       2053     2055       +2     
Files Coverage Δ
golem/core/adapter/nx_adapter.py 81.66% <ø> (-0.31%) ⬇️
golem/core/optimisers/genetic/gp_operators.py 92.20% <100.00%> (+0.54%) ⬆️
golem/core/optimisers/optimizer.py 95.60% <100.00%> (+0.04%) ⬆️

... and 5 files with indirect coverage changes

@YamLyubov YamLyubov requested a review from maypink October 10, 2023 10:03
@YamLyubov YamLyubov linked an issue Oct 10, 2023 that may be closed by this pull request
@@ -0,0 +1,57 @@
from functools import partial
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в названии файла потерялось нижнее подчеркивание))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

# Generate simple initial population with cyclic graphs
initial_graphs = [generate_labeled_graph('tree', i) for i in range(4, 20)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сюда наверно тоже надо прокинуть graph_type, а не tree по дефолту

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -34,7 +34,8 @@ def test_adapters_params_correct(adapter, graph_with_params):
if isinstance(graph, Graph):
restored_alpha = restored_graph.root_node.content['params']['alpha']
else:
restored_alpha = restored_graph.nodes['c']['alpha']
root_node = [node for node, data in restored_graph.nodes(data='alpha', default=None) if data is not None][0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему просто не взять ноду с тем же индексом? судя по всему, в нетворксе они также идут в порядке обхода в глубину

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал немного читаемее

@YamLyubov YamLyubov requested a review from maypink October 10, 2023 12:11
@YamLyubov YamLyubov merged commit fcc23ec into main Oct 19, 2023
5 checks passed
@YamLyubov YamLyubov deleted the fix_crossover branch October 19, 2023 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crossover for dag and tree structures
4 participants