Comments (2)
can you change your example so it does not use x[1]
as param ids but x1 etc instead.
from mlrmbo.
I repaced [x1], x[2], x[3], x[4] with x1, x2, x3, x4:
library(mlrMBO)
library(dplyr)
library(ParamHelpers)
a1 = rnorm(1000,100,10)
b1 = rnorm(1000,100,9)
c1 = sample.int(1000, 1000, replace = TRUE)
train_data = data.frame(a1,b1,c1)
obj.fun = makeMultiObjectiveFunction(
name = "Some function",
fn = function(x1,x2,x3,x4) {
#bin data according to random criteria
train_data <- train_data %>%
mutate(cat = ifelse(a1 <= x1 & b1 <= x3, "a",
ifelse(a1 <= x2 & b1 <= x4, "b", "c")))
train_data$cat = as.factor(train_data$cat)
#new splits
a_table = train_data %>%
filter(cat == "a") %>%
select(a1, b1, c1, cat)
b_table = train_data %>%
filter(cat == "b") %>%
select(a1, b1, c1, cat)
c_table = train_data %>%
filter(cat == "c") %>%
select(a1, b1, c1, cat)
#calculate quantile ("quant") for each bin
table_a = data.frame(a_table%>% group_by(cat) %>%
mutate(quant = ifelse(c1 > 150,1,0 )))
table_b = data.frame(b_table%>% group_by(cat) %>%
mutate(quant = ifelse(c1 > 300,1,0 )))
table_c = data.frame(c_table%>% group_by(cat) %>%
mutate(quant = ifelse(c1 > 400,1,0 )))
f1 = mean(table_a$quant)
f2 = mean(table_b$quant)
f3 = mean(table_c$quant)
#group all tables
final_table = rbind(table_a, table_b, table_c)
# calculate the total mean : this is what needs to be optimized
f4 = mean(final_table$quant)
return (f1, f2, f3, f4);
},
par.set = makeParamSet(
makeNumericParam("x1", lower = 80, upper = 90),
makeNumericParam("x2", lower = 95, upper = 110),
makeNumericParam("x3", lower = 80, upper = 90),
makeNumericParam("x4", lower = 95, upper = 110),
forbidden = expression(x2 >x1 & x4 >x3)
),
minimize = TRUE
)
ctrl = makeMBOControl()
ctrl = setMBOControlTermination(ctrl, iters = 20L)
# we can basically do an exhaustive search in 3 values
ctrl = setMBOControlInfill(ctrl, crit = makeMBOInfillCritEI())
# opt.restarts = 1L, opt.focussearch.points = 3L, opt.focussearch.maxit = 1L)
#design = generateDesign(20L, getParamSet(obj.fun), fun = lhs::maximinLHS)
lrn = makeMBOLearner(ctrl, obj.fun)
res = mbo(obj.fun, design = NULL, learner = lrn, control = ctrl, show.info = TRUE)
But this code has been running for the past few hours ... Am I doing something wrong?
Thank you so much!
from mlrmbo.
Related Issues (20)
- invalid class “km” object: the number of experiments must be larger than the spatial dimension HOT 2
- invalid class “km” object: the number of experiments must be larger than the spatial dimension HOT 7
- pkgdown-site points to slack HOT 1
- human in the loop mbo fails if final.evals is != 0
- Undocumented ranges for settings
- Error in if (err < tol) break : missing value where TRUE/FALSE needed for 'classif.gausspr' HOT 6
- The 'configureMlr' can not work with the parallel computing HOT 4
- qLCB not implemented perfectly
- The solution to the died training-No return HOT 1
- Test failure on R-devel HOT 3
- MOIMBO with interleave.random.points causes error HOT 1
- Unable to install mlrMBO using install.packages dependencies=T. I am on IOS and using R v 1.4, someone else? HOT 4
- optimizing "multiple objective" functions with "constraints" HOT 3
- Error: unused arguments (forbidden = expression(x2 > x1)) HOT 1
- Error: Error in as.data.frame.OptPathDF(opt.path, include.rest = FALSE) : No elements where selected (via 'dob' and 'eol')! HOT 8
- Error: Setting of final.method and final.evals for multi-objective optimization not supported at the moment.
- Possible lack of consistency in xgboost hyperparameters optimization?
- error with AEI again
- Multi-task hyperparameter tuning using bayesian optimization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlrmbo.