我最近正在训练lightgbm模型。特征尺寸为10,000,000 *70。但是,我不知道为什么我的训练会在3或4分钟后结束,而我的同事对具有类似特征尺寸的模型训练却在近1个小时后结束。
这是我设置lightgbm的方法:
import lightgbm as lgb
train_data = lgb.Dataset(train_feat, label=train_label)
valid_data = lgb.Dataset(train_feat, train_label, reference=train_data)
param = {'num_leaves': 20, 'objective': 'binary',
'num_threads':4, 'metric':'logloss',"learning_rate" : 0.01,
"bagging_freq": 5, "bagging_fraction" : 0.8, "seed": 42,
'bagging_seed':42
}
import time
since=time.time()
bst = lgb.train(param, train_data, valid_sets=[valid_data])
time_taken=time.time()-since
print("time cost for 100 round training: %dmin %ds" % (time_taken//60, time_taken%60))