How ramithuh/diff-evol-tree-search works
Project Overview
• Project Type: A research-focused, command-line driven experimentation tool for evolutionary tree search using differentiable optimization.
• Purpose: To construct and optimize phylogenetic trees from leaf sequences, offering a differentiable approach to traditional parsimony methods in evolutionary computing.
Main Components
• Input Handling & Parameter Parsing:
• Files: arg_parser_v2.py, various command-line parameters shown in README.
• Role: Parse input arguments (e.g., number of leaves, sequence length, mutation rate, etc.) that configure the experimental runs.
• Core Tree Generation & Optimization Modules:
• Files in modules/: gt_tree_gen.py, sankoff.py, tree_func.py.
• Role: Implement the key algorithms and mathematical models to generate trees, calculate parsimony scores, and perform differentiable optimization.
• Statistics & Utility Functions:
• Files: gt_stats.py, modules/vis_utils.py.
• Role: Compute statistics during training (e.g., soft_parsimony_score, parsimony_score) and provide visualization utilities to illustrate tree structures.
• Training & Runner Scripts:
• Files: seed_runner_maximum_parsimony.py, seed_runner_small_parismony.py, train_batch_alt.py, train_batch_implicit_diff.py, train_small_parsimony.py.
• Role: Orchestrate the training process; each script may represent different experiment configurations (e.g., with implicit differentiation feature or maximum parsimony variants).
• Deployment / Experimentation Interface:
• File: run_on_colab.ipynb.
• Role: Provide an interactive, notebook-based interface for running the experiments on Google Colab.
• External Configuration:
• Files: requirements.txt.
• Role: List dependencies used by the project (e.g., Python libraries for numerical computation and optimization).
Defining Relationships and Interactions
• Input flow starts with the user providing arguments/configurations (likely via command-line or interactive notebook).
• The main runner scripts trigger the training processes, which call on the tree generation modules to build tree structures based on the parsed parameters.
• Core modules collaborate in the loop: the algorithm computes parsimony scores (via [sankoff.py, tree_func.py]) with utilities in vis_utils.py optionally rendering visuals.
• The gt_stats.py module collects and logs performance metrics throughout training, with outputs (scores) being printed at regular intervals.
• Experiment settings may change the behavior (e.g., different training approaches like maximum parsimony or implicit differentiation) based on the selected script.
• Finally, colab notebooks provide an end-user interface that wraps these components into a user-friendly, documented execution environment.
Architectural Patterns & Technologies
• Command-line Interface/Script-Based Architecture: Multiple entry points (scripts) allow switching between approaches.
• Modular Design: Separate folders and files encapsulate specific functionality (tree generation, statistics, visualization), promoting separation of concerns.
• Research/Experimental Design: Direct scripts to experiment with model optimization parameters and configurations in evolutionary computation.
• Differentiable Optimization: Central to the approach, emphasizing gradient-based methods to adjust tree topology and sequence parameters.