You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/07/31 17:43:04 UTC

[GitHub] sagaragrawal13 opened a new issue #7269: Bayesian Optimization for MXNET

sagaragrawal13 opened a new issue #7269: Bayesian Optimization for MXNET
URL: https://github.com/apache/incubator-mxnet/issues/7269
 
 
   Could you please provide a good reference to get started with Bayesian Optimization on models built through MXNET R package. 
   
   I plan to use Bayesian Optimization R package - rBayesianOptimization for parameter tuning for CNN model built using MXNET 
   
   Parameters : Number of filter, filter size, stride, Activation function
   
   I was able to use Bayesian Optimization for XGBoost through example provided in vignette. Issue comes in where a model built in MXNET using mx.model.FeedForward.create does not result in any evaluation log etc so that I can link it to Bayesian Optimization. 
   
   XGBoost: 
   
   install.packages("xgboost")
   install.packages("rBayesianOptimization")
   library(rBayesianOptimization)
   
   # Example 2: Parameter Tuning
   library(xgboost)
   data(agaricus.train, package = "xgboost")
   dtrain <- xgb.DMatrix(agaricus.train$data,
                         label = agaricus.train$label)
   cv_folds <- KFold(agaricus.train$label, nfolds = 5,
                     stratified = TRUE, seed = 0)
   
   ## End(Not run)
   xgb_cv_bayes <- function(max.depth, min_child_weight, subsample) {
     cv <- xgb.cv(params = list(booster = "gbtree", eta = 0.01,
                                max_depth = max.depth,
                                min_child_weight = min_child_weight,
                                subsample = subsample, colsample_bytree = 0.3,
                                lambda = 1, alpha = 0,
                                objective = "binary:logistic",
                                eval_metric = "auc"),
                  data = dtrain, nround = 100,
                  folds = cv_folds, prediction = TRUE, showsd = TRUE,
                  early_stopping_rounds = 5, maximize = TRUE, verbose = 0)
     list(Score = cv$evaluation_log[, max(test_auc_mean)],
          Pred = cv$pred)
   }
   OPT_Res <- BayesianOptimization(xgb_cv_bayes,
                                   bounds = list(max.depth = c(2L, 6L),
                                                 min_child_weight = c(1L, 10L),
                                                 subsample = c(0.5, 0.8)),
                                  init_grid_dt = NULL, init_points = 10, n_iter = 20,
                                   acq = "ucb", kappa = 2.576, eps = 0.0,
                                   verbose = TRUE)
   
   Best
   SA
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services