Created
August 5, 2022 14:39
-
-
Save davipatti/1e2805a21baad6364458c50b224a9e91 to your computer and use it in GitHub Desktop.
Run optimizeAgReactivity on every nth optimisation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Racmacs) | |
library(progress) | |
# Make a map with 1000 optimisations | |
n_optim <- 1000 | |
titers <- read.titerTable("hi.csv") | |
map <- make.acmap(titer_table = titers, number_of_dimensions = 2, number_of_optimizations = n_optim) | |
# Run reactivity optimisation on every 500th optimisation | |
# I.e. this will generate 1000/500 = 2 maps | |
skip <- 500 | |
n_iter <- n_optim / skip | |
# Make sure the optimisations are sorted, so that skipping samples diverse maps | |
map <- sortOptimizations(map) | |
# Set up a progress bar | |
pb <- progress_bar$new( | |
format = "(:spin) [:bar] :percent [Elapsed time: :elapsedfull || Estimated time remaining: :eta]", | |
total = n_iter, | |
) | |
# For storing results | |
reactivity_adjusted <- list() | |
for (i in 1:n_iter) { | |
# Increment progress bar | |
pb$tick() | |
# Run reactivity adjustment | |
reactivity_adjusted[[i]] <- optimizeAgReactivity(map, optimization_number = i * skip) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment