Skip to content

Instantly share code, notes, and snippets.

@okanyenigun
Created September 13, 2022 13:51
Show Gist options
  • Save okanyenigun/7516c984cad9b174dedff5c3b0672ba0 to your computer and use it in GitHub Desktop.
Save okanyenigun/7516c984cad9b174dedff5c3b0672ba0 to your computer and use it in GitHub Desktop.
light gbm
import lightgbm as lgb
from sklearn.model_selection import GridSearchCV
param_grid = {
'objective': ["binary"],
'metric': ['binary_logloss'],
'boosting': ['gbdt','dart'],
'lambda_l1': [0, 0.1, 0.01],
'bagging_fraction': [0.7, 0.9],
'bagging_freq': [0,1],
'num_leaves': [32, 64, 128],
'max_depth': [-1, 10],
'max_bin': [100, 255],
'num_iterations': [100, 200],
'learning_rate':[0.01,0.1],
'min_data_in_leaf': [3,5]
}
estimator = lgb.LGBMClassifier()
searcher = GridSearchCV(
estimator=estimator,
param_grid=param_grid,
cv=5,
n_jobs=-1,
scoring='accuracy',
verbose=2)
grid_model = searcher.fit(X_train, y_train)
y_pred =grid_model.predict(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment