Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
dumb way to survey server for parconfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob-r committed Mar 29, 2017
1 parent 000ca73 commit 5939bd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion R/downloadParConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ downloadParConfigs = function(ids) {
}

db.res = httr::content(req)
db.res = unique(db.res)
db.res = db.res[!sapply(extractSubList(db.res, "json_parconfig"), is.null)]

# loop through ids
par.configs = lapply(db.res, function(x) {
x = x[nzchar(x)]
par.set = JSONtoParSet(x$json_parconfig)
par.vals = JSONtoParVals(x$json_parvals)
makeParConfig(par.set = par.set, par.vals = par.vals, learner = x$learner_class)
makeParConfig(par.set = par.set, par.vals = par.vals, learner = x$learner_class, learner.name = x$learner_name)
})

par.configs
Expand Down
13 changes: 8 additions & 5 deletions R/uploadParConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@

uploadParConfig = function(par.config, user.email = NULL) {
assert_class(par.config, "ParConfig")
user.email = coalesce(user.email, "<anonymous>")
assert_string(user.email, null.ok = TRUE)
if (is.null(user.email)) {
user.email = "<anonymous>"
}

learner.class = getParConfigLearnerClass(par.config)
learner.class = coalesce(getParConfigLearnerClass(par.config), "")
learner.type = coalesce(getParConfigLearnerType(par.config), "")
learner.name = coalesce(getParConfigLearnerName(par.config), "")

post = list(
user_email = user.email,
json_parconfig = parSetToJSON(getParConfigParSet(par.config)),
json_parvals = parValsToJSON(getParConfigParVals(par.config)),
learner_class = learner.class
learner_class = learner.class,
learner_type = learner.type,
learner_name = learner.name
)

req = httr::POST("http://mlrhyperopt.jakob-r.de/upload.php", body = post, encode = "json", httr::accept_json())
Expand Down

0 comments on commit 5939bd9

Please sign in to comment.