轻型GBM
高性能渐变增强-适用于Ruby
安装
将此行添加到您的应用程序的Gemfile中:
gem 'lightgbm'
在Mac上,还要安装OpenMP:
brew install libomp
培训API
准备数据
x = [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] , [ 7 , 8 ] ]
y = [ 1 , 2 , 3 , 4 ]
训练模型
params = { objective : "regression" }
train_set = LightGBM :: Dataset . new ( x , label : y )
booster = LightGBM . train ( params , train_set )
预测
booster . predict ( x )
将模型保存到文件
booster . save_mode
1