library(RLightGBM)
data(example.binary)
num_iterations <- 100
config <- list(objective = "binary", metric="binary_logloss,auc", learning_rate = 0.1, num_leaves = 63, tree_learner = "serial", feature_fraction = 0.8, bagging_freq = 5, bagging_fraction = 0.8, min_data_in_leaf = 50, min_sum_hessian_in_leaf = 5.0)
handle.data <- lgbm.data.create(x)
lgbm.data.setField(handle.data, "label", y)
handle.booster <- lgbm.booster.create(handle.data, lapply(config, as.character))
lgbm.booster.train(handle.booster, num_iterations, 5)
pred <- lgbm.booster.predict(handle.booster, x.test)
sum(y.test == (y.pred > 0.5)) / length(y.test)
lgbm.booster.save(handle.booster, filename = "/tmp/model.txt")