mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 10:47:25 +01:00
ranking: Remove caching for optimization
This commit is contained in:
parent
57fc119993
commit
33cc33f81a
1 changed files with 27 additions and 32 deletions
|
|
@ -65,10 +65,7 @@ optimal_weights <- function(analysis, methods, reference_gene_ids,
|
||||||
stop("Invalid analyis. Use geposan::analyze().")
|
stop("Invalid analyis. Use geposan::analyze().")
|
||||||
}
|
}
|
||||||
|
|
||||||
cached(
|
|
||||||
"optimization",
|
|
||||||
c(analysis$preset, methods, reference_gene_ids, target),
|
|
||||||
{ # nolint
|
|
||||||
# Compute the target rank of the reference genes when applying the
|
# Compute the target rank of the reference genes when applying the
|
||||||
# weights.
|
# weights.
|
||||||
target_rank <- function(factors) {
|
target_rank <- function(factors) {
|
||||||
|
|
@ -100,6 +97,4 @@ optimal_weights <- function(analysis, methods, reference_gene_ids,
|
||||||
optimal_factors <- stats::optim(initial_factors, target_rank)$par
|
optimal_factors <- stats::optim(initial_factors, target_rank)$par
|
||||||
|
|
||||||
as.list(optimal_factors / max(abs(optimal_factors)))
|
as.list(optimal_factors / max(abs(optimal_factors)))
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue