#' A wrapper for xgboost
#'
#' @param x numeric
#' @return xgboost trained
xgboost_wrapper <- function(x) {
if (x == 1) {
dtrain <- xgboost::xgb.DMatrix(data = as.matrix(datasets::iris[, 2:4]),
label = as.numeric(datasets::iris$Species))
out <- xgboost::xgboost(data = dtrain,
max.depth = 2,
eta = 1,
nthread = 2,
nrounds = 2)
}
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.