Skip to content

Commit

Permalink
"Temporarily" updated register() to perform 3 sequential registration…
Browse files Browse the repository at this point in the history
…s when using Nelder-Mead, this improves the results of optimal stretch and shift parameters
  • Loading branch information
ruthkr committed Aug 29, 2023
1 parent 8177136 commit defadaa
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion R/register.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,23 @@ register <- function(input,
loglik_separate <- calc_loglik_H2(gene_data)

# Register for Hypothesis 1
results <- register_with_optimisation(gene_data, stretches, shifts, loglik_separate, overlapping_percent, optimisation_config, optimise_fun)
if (optimisation_method == "nm") {
# Perform multiple optimisation rounds for Nelder-Mead
results_round1 <- register_with_optimisation(gene_data, stretches, shifts, loglik_separate, overlapping_percent, optimisation_config, optimise_fun)

# Perform the second round
stretches <- results_round1$model_comparison$stretch
shifts <- results_round1$model_comparison$shift
results_round2 <- register_with_optimisation(gene_data, stretches, shifts, loglik_separate, overlapping_percent, optimisation_config, optimise_fun)

# Perform the third round
stretches <- results_round2$model_comparison$stretch
shifts <- results_round2$model_comparison$shift
results <- register_with_optimisation(gene_data, stretches, shifts, loglik_separate, overlapping_percent, optimisation_config, optimise_fun)
} else {
# Perform optimisation with other optimisation methods
results <- register_with_optimisation(gene_data, stretches, shifts, loglik_separate, overlapping_percent, optimisation_config, optimise_fun)
}

return(results)
}
Expand Down

0 comments on commit defadaa

Please sign in to comment.