I hereby claim:
- I am jakob-r on github.
- I am jakobr (https://keybase.io/jakobr) on keybase.
- I have a public key ASA0uw1eePgkoFeZK9YbYrkjVOld8XKdql-qIFLAALvwWwo
To claim this, I am signing this object:
# Author: Jakob Richter (https://gist.github.com/jakob-r) | |
# colfuncMiddle does the same as colfunc but gives respect to middle point. | |
# usage: x : numeric() | |
# colfunc: function generated by colorRampPalette() | |
# zeropoint: numeric(1) | |
colfuncMiddle = function(x, colfunc, n, zeropoint=0){ | |
stopifnot(is.numeric(x) | is.factor(x)) | |
if(!missing(n)){ | |
stopifnot(length(n)==1) |
library(checkmate) | |
library(mlr) | |
makePersp3DLayer = function(opt.path.dt, par.set = NULL, learner, y = "y", x = NULL, resolution = 100, nrow.limit = 400) { | |
x = coalesce(x, getParamIds(par.set)) | |
assertCharacter(x, len = 2) | |
data = opt.path.dt[, c(x,y), with=FALSE] | |
if (nrow(opt.path.dt) > nrow.limit) { | |
data = data[sample(nrow(data), size = nrow.limit),] | |
} |
waitAndSubmitExpired = function(reg, resources, wait = 30, ...) { | |
done.ids = findDone(reg) | |
error.ids = findErrors(reg) | |
expired.ids = findExpired(reg) | |
submitted.ids = findSubmitted(reg) | |
restarted.ids = numeric() | |
while (!all(submitted.ids %in% c(done.ids, error.ids))) { | |
if (length(expired.ids) > 0) | |
submitJobs(reg, expired.ids, resources = resources, ...) |
surrogate.learner = makeLearner("regr.randomForest", predict.type = "se") | |
myTrafo = function(data, target, category, na.val) { | |
catf("run mytrafon on data with") | |
data.notarget = data[, colnames(data) != target, drop = FALSE] | |
data = cbind(dcast(data.notarget, as.formula(paste0("seq_along(", category, ")~",category)), fill = na.val, value.var = "x", drop = FALSE)[, -1, drop = FALSE], data[,colnames(data) %in% c(category, target), drop = FALSE]) | |
return(data) | |
} | |
wrpTrain = function(data, target, args) { | |
data = myTrafo(data = data, target = target, category = args$category, na.val = args$na.val) |
library(mlrMBO) | |
library(data.table) | |
library(ggplot2) | |
configureMlr(on.par.without.desc = "warn") | |
set.seed(1) | |
# Define objective function | |
fn = makeRosenbrockFunction(5) | |
# define mbo control object | |
ctrl = makeMBOControl(propose.points = 4, store.model.at = 0:20) |
library(mlrMBO) | |
library(stringi) | |
library(jsonlite) | |
# read command line args (in a not very safe way) | |
# Script can be called like that: | |
# Rscript runMBO.R iters=20 time=10 seed=1 | |
args = commandArgs(TRUE) | |
# defaults: | |
iters = 50 |
n = 5 | |
x = runif(1000 * n) | |
mat = matrix(x, ncol = n) | |
mat2 = apply(mat, 1, function(x) { | |
ox = order(x) | |
rox = match(x, x[ox]) | |
dx = diff(c(0,x[ox])) | |
dx[rox] | |
}) | |
mat2 = t(mat2) |
I hereby claim:
To claim this, I am signing this object:
#' @title Build ensemble of multiple learners with sampled hyperparameters. | |
#' | |
#' @description | |
#' Define a learner and define which hyperparameters should get sampled. | |
#' The ensemble will be build of multiple learners, each with different random hyperparamters. | |
#' The predictions for mean and se will be averaged. | |
#' | |
#' @template arg_learner | |
#' @param samplers (`list`)\cr | |
#' A named list of functions that create the random samples: |
\documentclass{beamer} | |
\usepackage[absolute,overlay]{textpos} | |
\usepackage{import} | |
\setbeamercolor{background canvas}{bg=gray} | |
\setkeys{Gin}{width=\linewidth} % default of includegraphics width | |
\begin{document} |