lightgbm

How to pass multiple hyperparameters to LightGBM after optimization?

How to pass multiple hyperparameters to LightGBM after optimization? Question: I have used another optimization algorithm that returns me best params for Light GBM. hyper_optimized_clf_classifier = Util.hp_opt(lgb.LGBMClassifier(silent=True, random_state=1), X, y, score, verbose=True, n_estimators =(hp.quniform,50,500,50), learning_rate =(hp.qloguniform, np.log(0.05), np.log(0.4),0.001), min_child_weight =(hp.qloguniform,np.log(3),np.log(200),1), reg_lambda = (hp.qloguniform, np.log(2), np.log(100),1), num_leaves = (hp.qloguniform, np.log(5),np.log(64),1), subsample = (hp.quniform, 0.5, 1, 0.05), …

Total answers: 1

Lightgbm early stopping not working properly

Lightgbm early stopping not working properly Question: I’m using lightgbm for a machine learning task. I want to use early stopping in order to find the optimal number of trees given a number of hyperparameters. However, lgbm stops growing trees while still improving on my evaluation metric. Below I’ve attached my specifications: params = { …

Total answers: 1

How to save to disk / export a lightgbm LGBMRegressor model trained in python?

How to save to disk / export a lightgbm LGBMRegressor model trained in python? Question: Hi I am unable to find a way to save a lightgbm.LGBMRegressor model to a file for later re-use. Asked By: Utpal Datta || Source Answers: Try: my_model.booster_.save_model(‘mode.txt’) #load from model: bst = lgb.Booster(model_file=’mode.txt’) Note: the API state that bst …

Total answers: 4

f1_score metric in lightgbm

f1_score metric in lightgbm Question: I want to train a lgb model with custom metric : f1_score with weighted average. I went through the advanced examples of lightgbm over here and found the implementation of custom binary error function. I implemented as similar function to return f1_score as shown below. def f1_metric(preds, train_data): labels = …

Total answers: 2

LightGBMError "Check failed: num_data > 0" with Sklearn RandomizedSearchCV

LightGBMError "Check failed: num_data > 0" with Sklearn RandomizedSearchCV Question: I’m trying LightGBMRegressor parameter tuning with Sklearn RandomizedSearchCV. I got an error with message below. error: LightGBMError: b’Check failed: num_data > 0 at /src/LightGBM/src/io/dataset.cpp, line 27 .n’ I cannot tell why and the specific parameters caused this error. Any of params_dist below was not suitable …

Total answers: 4

Python – LightGBM with GridSearchCV, is running forever

Python – LightGBM with GridSearchCV, is running forever Question: Recently, I am doing multiple experiments to compare Python XgBoost and LightGBM. It seems that this LightGBM is a new algorithm that people say it works better than XGBoost in both speed and accuracy. This is LightGBM GitHub. This is LightGBM python API documents, here you …

Total answers: 2

Lightgbm OSError, Library not loaded

Lightgbm OSError, Library not loaded Question: If I simply do: import lightgbm as lgb I’m getting python script.py Traceback (most recent call last): File “script.py”, line 4, in <module> import lightgbm as lgb File “/usr/local/lib/python2.7/site-packages/lightgbm/__init__.py”, line 8, in <module> from .basic import Booster, Dataset File “/usr/local/lib/python2.7/site-packages/lightgbm/basic.py”, line 31, in <module> _LIB = _load_lib() File “/usr/local/lib/python2.7/site-packages/lightgbm/basic.py”, …

Total answers: 9

Why ImportError: No module named lightgbm

Why ImportError: No module named lightgbm Question: My OS is Ubuntu, and I’ve followed the official installation guide to install lightgbm. However, when I import it, this error is raised: ImportError: No module named lightgbm How can I solve this? Do I also need to go to /python-package folder to run setup.py after running those …

Total answers: 7