Skip to content

perf: fetch only necessary data in asha multi-crit #117

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions R/OptimizerAsyncSuccessiveHalving.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ OptimizerAsyncSuccessiveHalving = R6Class("OptimizerAsyncSuccessiveHalving",

mlr_optimizers$add("async_successive_halving", OptimizerAsyncSuccessiveHalving)

# the multi-crit version fetches all results from Redis and applies non-dominated sorting to select the best configurations
optimize_asha_multi = function(inst, self, private) {
archive = inst$archive
r_min = private$.r_min
Expand Down Expand Up @@ -174,8 +175,9 @@ optimize_asha_multi = function(inst, self, private) {
for (s in seq(s_max)) {
lg$debug("Fetching results from other workers")

# fetch finished points of current stage
data_stage = archive$finished_data[list(s), , on = "stage"]
# fetch results and subset to current stage
browser()
data_stage = archive$rush$fetch_finished_tasks(fields = c("ys", "ys_extra"))[list(s), , on = "stage"]

# how many configurations can be promoted to the next stage
# at least one configuration must be promotable
Expand Down Expand Up @@ -207,6 +209,8 @@ optimize_asha_multi = function(inst, self, private) {
}
}

# the single-crit version fetches no results from Redis but uses sorted sets to get the rank of the current configuration
# this has almost no overhead compared to fetching the results and doing the ranking in R
optimize_asha_single = function(inst, self, private) {
archive = inst$archive
r_min = private$.r_min
Expand Down
Loading