有时我会保存一个 LightGBM 模型,然后在重新加载它时,想要访问有关模型构建方式的一些详细信息。例如,有没有办法恢复这个事实objective = "regression"
?
为方便起见,这里有一些简短的代码可供使用:
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
data(agaricus.test, package = "lightgbm")
params <- list(objective = "regression", metric = "l2")
model <- lgb.train(params,
dtrain,
100,
min_data = 1,
learning_rate = 1)
names(model)
我看不到如何从任何模型属性中检索任何模型参数:
> names(model)
[1] ".__enclos_env__" "raw" "record_evals" "best_score"
[5] "best_iter" "save" "to_predictor" "predict"
[9] "dump_model" "save_model_to_string" "save_model" "eval_valid"
[13] "eval_train" "eval" "current_iter" "rollback_one_iter"
[17] "update" "reset_parameter" "add_valid" "set_train_data_name"
[21] "initialize" "finalize"