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 fix: Optimizing branch lengths in NNI Engine via GP #484

Merged
merged 10 commits into from
Dec 19, 2023

Conversation

davidrich27
Copy link
Collaborator

@davidrich27 davidrich27 commented Dec 12, 2023

Description

  • Fixes bug that caused NNI search to not optimize new branches when using a GP evaluation engine.
  • Adds pybito function that gives NNIEngine read access to its evaluation engine's branch lengths (if using a parsimony engine that does not have branch lengths, throws error.)
  • Minor fixes to fully_connect and git_commit functions.

Closes #483

Tests

N/A

Checklist:

  • Code follows our detailed contribution guidelines
  • clang-format has been run
  • TODOs have been eliminated from the code
  • Comments are up to date, document intent, and there are no commented-out code blocks
  • Issue branch has been squashed and rebased on main branch
  • GitHub CI build on PR branch completed successfully

@davidrich27 davidrich27 changed the title 483 nni search gp branch lengths fix Bug fix: Optimizing branch lengths in NNI Engine via GP Dec 12, 2023
// std::ignore = pre_nni;
// NNIBranchLengthOptimization(nni, new_edge_ids);
// }
// GetGPEngine().ProcessOperations(GetDAG().PopulatePLVs());
Copy link
Collaborator

@chrisjenningsshaffer chrisjenningsshaffer Dec 14, 2023

Choose a reason for hiding this comment

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

Is it safe to now remove the commented code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

}

GetGPEngine().ProcessOperations(GetDAG().ComputeLikelihoods());
auto likelihoods = GetGPEngine().GetPerGPCSPLogLikelihoods();
std::cout << "GPEngine::UpdateEngineAfterModifying [END]" << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's either remove the printed message or make it optional with an is_quiet parameter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

// GetLikelihoodEvalEngine().GetDAGBranchHandler().GetBranchLengthData();
// return log_likelihoods.block(0, 0, GetEdgeCount(), log_likelihoods.cols());
// }
const PLVEdgeHandler &GetLikelihoodPVs() const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Commented code can go?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

"Adds all valid edges with present nodes to the DAG.")
.def(
"fully_connect", [](GPDAG &self) { self.FullyConnect(); },
"Adds all valid edges with present nodes to the DAG.")
// ** I/O
Copy link
Collaborator

Choose a reason for hiding this comment

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

Python complains with this version because it doesn't know about the return type. I've removed the return value, since we don't need it on the python side and that's less work than exposing it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like you made these changes.

Copy link
Collaborator

@chrisjenningsshaffer chrisjenningsshaffer left a comment

Choose a reason for hiding this comment

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

Minor stuff only.

@davidrich27 davidrich27 merged commit d8eded6 into main Dec 19, 2023
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.

Bug: GP Branch lengths are not being updated from default branch length during NNI search.
2 participants