mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 10:47:25 +01:00
Add framework for progress information
This commit is contained in:
parent
16e83d38a8
commit
37f468658c
6 changed files with 76 additions and 11 deletions
16
R/neural.R
16
R/neural.R
|
|
@ -1,7 +1,7 @@
|
|||
# Find genes by training a neural network on reference position data.
|
||||
#
|
||||
# @param seed A seed to get reproducible results.
|
||||
neural <- function(distances, preset, seed = 448077) {
|
||||
neural <- function(distances, preset, progress = NULL, seed = 448077) {
|
||||
species_ids <- preset$species_ids
|
||||
reference_gene_ids <- preset$reference_gene_ids
|
||||
|
||||
|
|
@ -89,8 +89,20 @@ neural <- function(distances, preset, seed = 448077) {
|
|||
linear.output = FALSE
|
||||
)
|
||||
|
||||
# Return the resulting scores given by applying the neural network.
|
||||
if (!is.null(progress)) {
|
||||
# We do everything in one go, so it's not possible to report detailed
|
||||
# progress information. As the method is relatively quick, this should
|
||||
# not be a problem.
|
||||
progress(0.5)
|
||||
}
|
||||
|
||||
# Apply the neural network.
|
||||
data[, score := neuralnet::compute(nn, data)$net.result]
|
||||
|
||||
if (!is.null(progress)) {
|
||||
# See above.
|
||||
progress(1.0)
|
||||
}
|
||||
|
||||
data[, .(gene, score)]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue