Skip to content

Commit ed874ab

Browse files
authored
Merge pull request #59 from jvm123/feat-evolution-graph-visualizer
Feature: Visualization script for the evolution tree from a checkpoint
2 parents 25638a5 + 4fc4605 commit ed874ab

File tree

17 files changed

+2928
-2
lines changed

17 files changed

+2928
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
applyTo: 'scripts/**/*.js'
3+
---
4+
- In this program, a dataset with nodes and edges is visualized in different graphs and lists. These view modes are selectable in tabs.
5+
- Nodes are parametrized with meta data including program ID, island number, generation nunmber, parent ID (which is used to determine the edge connections), a metric dataset with flexible keys, a code string, a dict with prompts and more. All data except program ID are optional.
6+
- A sidebar shows detailed node information. Its format is the same across all view modes.
7+
- The sidebar in this program is designed to show up dynamically when a node is selected in one of the graphs or lists. It appears on hover of the node and hides when the node is not hovered anymore.
8+
- A single node can be selected to turn it "sticky". When a node is sticky, its information remains visible in the sidebar and the sidebar remains open until the user clicks in the background. Hovering another node will not change the sidebar content if a node is already sticky.
9+
- The selected node is highlighted with a red border and synchronized across all graphs and lists. I.e., clicking a node in a list will also highlight it in the graphs.
10+
11+
- A select box #highlight-select configures a filter logic that allows to highlight multiple nodes. Nodes are highlighted with a blue shadow in the graphs and lists.
12+
- A select box #metric-select shows the available metrics (determined dynamically from the dataset), and the selected metric may be used in the graph creation, filter and sorting logic.

.github/workflows/python-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ jobs:
1313
- uses: psf/black@stable
1414
with:
1515
options: "--check --verbose"
16-
src: "./openevolve ./tests ./examples"
16+
src: "./openevolve ./tests ./examples ./scripts"
1717
use_pyproject: true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ install: venv
3333
# Run Black code formatting
3434
.PHONY: lint
3535
lint: venv
36-
$(PYTHON) -m black openevolve examples tests
36+
$(PYTHON) -m black openevolve examples tests scripts
3737

3838
# Run tests using the virtual environment
3939
.PHONY: test

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ diff -u checkpoints/checkpoint_10/best_program.py checkpoints/checkpoint_20/best
128128
# Compare metrics
129129
cat checkpoints/checkpoint_*/best_program_info.json | grep -A 10 metrics
130130
```
131+
132+
### Visualizing the evolution tree
133+
134+
The script in `scripts/visualize.py` allows you to visualize the evolution tree and display it in your webbrowser. The script watches live for the newest checkpoint directory in the examples/ folder structure and updates the graph. Alternatively, you can also provide a specific checkpoint folder with the `--path` parameter.
135+
136+
```bash
137+
# Install requirements
138+
pip install -r scripts/requirements.txt
139+
140+
# Start the visualization web server
141+
python scripts/visualizer.py
142+
```
143+
![OpenEvolve Visualizer](openevolve-visualizer.png)
144+
131145
### Docker
132146

133147
You can also install and execute via Docker:

openevolve-visualizer.png

646 KB
Loading

scripts/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flask

0 commit comments

Comments
 (0)