Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created December 29, 2019 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/a042610d1531d230d3d7529f4bcab2f9 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/a042610d1531d230d3d7529f4bcab2f9 to your computer and use it in GitHub Desktop.
import lightgbm as lgbm
train_data = lgbm.Dataset(xtrain, ytrain)
test_data = lgbm.Dataset(xtest, ytest)
# define parameters
parameters = {
'objective': 'binary',
'metric': 'auc',
'is_unbalance': 'true',
'feature_fraction': 0.5,
'bagging_fraction': 0.5,
'bagging_freq': 20,
'num_threads' : 2,
'seed' : 76
}
# train lightGBM model
model = lgbm.train(parameters,
train_data,
valid_sets=test_data,
num_boost_round=1000,
early_stopping_rounds=20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment