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 issues having to do with standardization #49

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions netam/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ def joint_train(
print(
f"### Beginning cycle {cycle + 1}/{cycle_count} using optimizer {self.optimizer_name}"
)
self.mark_branch_lengths_optimized(cycle + 1)
current_lr = self.optimizer.param_groups[0]["lr"]
# set new_lr to be the geometric mean of current_lr and the
# originally-specified learning rate
Expand All @@ -775,8 +774,8 @@ def joint_train(
)
self.reset_optimization(new_lr)
loss_history_l.append(self.train(epochs, out_prefix=out_prefix))
if cycle < cycle_count - 1:
optimize_branch_lengths()
# We standardize and optimize the branch lengths after each cycle, even the last one.
optimize_branch_lengths()
self.mark_branch_lengths_optimized(cycle + 1)

return pd.concat(loss_history_l, ignore_index=True)
Expand Down Expand Up @@ -932,7 +931,7 @@ def _find_optimal_branch_length(
**optimization_kwargs,
):
if torch.sum(mutation_indicator) == 0:
return 0.0
return 0.0, False

rates, _ = self.model(
encoded_parent.unsqueeze(0),
Expand Down