refactor(opt): update optimisation classes#62
Merged
Neclow merged 2 commits intosbhattlab:mainfrom May 30, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the optimisation classes in Phylo2Vec to improve performance and clarity by removing the numba dependency for label mapping, introducing a verbose option with timing information, and addressing a bug in the HC class loss tolerance evaluation. Key changes include:
- Removing the numba dependency from pyproject.toml.
- Renaming parameters from taxa_dict to label_mapping and updating the associated logic in _hc_losses.py, _hc.py, and _base.py.
- Refactoring the base optimizer to infer n_jobs without using effective_n_jobs and adding timing output.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| py-phylo2vec/pyproject.toml | Removed the numba dependency and updated dependency comment |
| py-phylo2vec/phylo2vec/opt/_hc_losses.py | Updated parameter names in raxml_loss to use label_mapping |
| py-phylo2vec/phylo2vec/opt/_hc.py | Renamed taxa_dict to label_mapping; updated tolerance condition |
| py-phylo2vec/phylo2vec/opt/_base.py | Modified init to accept verbose and n_jobs; added _infer_n_jobs |
| docs/demo.ipynb | Updated documentation to reflect removal of numba dependency |
Comments suppressed due to low confidence (1)
py-phylo2vec/phylo2vec/opt/_hc_losses.py:19
- The docstring for raxml_loss still documents a parameter named 'taxa_dict'; it should be updated to 'label_mapping' to reflect the changes in the parameter name.
def raxml_loss(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
effective_n_jobsfrom joblib, which just seems to pick all jobs available)--> time on toy h3n2 dataset down to ~5 s (before: 60-70 s)
treesfolder (created by optimisation schemes by default)