Questions tagged [lightgbm]

LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed and efficient with the following advantages: ... Support of parallel and GPU learning. Capable of handling large-scale data.

LightGBM is a high performance gradient boosting (GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks. It is under the umbrella of the DMTK(http://github.com/microsoft/dmtk) project of Microsoft.

Resources:

676 questions
32
votes
9 answers

Lightgbm OSError, Library not loaded

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 import lightgbm as lgb File "/usr/local/lib/python2.7/site-packages/lightgbm/__init__.py", line 8, in…
LampShade
  • 2,675
  • 5
  • 30
  • 60
29
votes
4 answers

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

Hi I am unable to find a way to save a lightgbm.LGBMRegressor model to a file for later re-use.
Utpal Datta
  • 367
  • 1
  • 3
  • 8
24
votes
4 answers

Feature importance using lightgbm

I am trying to run my lightgbm for feature selection as below; initialization # Initialize an empty array to hold feature importances feature_importances = np.zeros(features_sample.shape[1]) # Create the model with several hyperparameters model =…
Ian Okeyo
  • 299
  • 1
  • 4
  • 7
24
votes
1 answer

How to use lightgbm.cv for regression?

I want to do a cross validation for LightGBM model with lgb.Dataset and use early_stopping_rounds. The following approach works without a problem with XGBoost's xgboost.cv. I prefer not to use Scikit Learn's approach with GridSearchCV, because it…
Marius
  • 409
  • 1
  • 5
  • 9
23
votes
3 answers

Cross-validation in LightGBM

How are we supposed to use the dictionary output from lightgbm.cv to improve our predictions? Here's an example - we train our cv model using the code below: cv_mod = lgb.cv(params, d_train, 500, …
Nlind
  • 331
  • 1
  • 3
  • 4
18
votes
3 answers

Python: How to retrive the best model from Optuna LightGBM study?

I would like to get the best model to use later in the notebook to predict using a different test batch. reproducible example (taken from Optuna Github) : import lightgbm as lgb import numpy as np import sklearn.datasets import sklearn.metrics from…
HarriS
  • 605
  • 1
  • 6
  • 19
18
votes
3 answers

LightGBM 'Using categorical_feature in Dataset.' Warning?

From my reading of the LightGBM document, one is supposed to define categorical features in the Dataset method. So I have the following code: cats=['C1', 'C2'] d_train = lgb.Dataset(X, label=y, categorical_feature=cats) However, I received the…
David293836
  • 1,165
  • 2
  • 18
  • 36
18
votes
4 answers

Multiclass Classification with LightGBM

I am trying to model a classifier for a multi-class Classification problem (3 Classes) using LightGBM in Python. I used the following parameters. params = {'task': 'train', 'boosting_type': 'gbdt', 'objective': 'multiclass', …
17
votes
2 answers

How does the predict_proba() function in LightGBM work internally?

This is in reference to understanding, internally, how the probabilities for a class are predicted using LightGBM. Other packages, like sklearn, provide thorough detail for their classifiers. For example: LogisticRegression returns: Probability…
artemis
  • 6,857
  • 11
  • 46
  • 99
16
votes
1 answer

What is the difference between model.LGBMRegressor.fit(x_train, y_train) and lightgbm.train(train_data, valid_sets = test_data)?

I tried out two ways of implementing light GBM. Expect it to return the same value but it didnt. I thought lgb.LightGBMRegressor() and lgb.train(train_data, test_data) will return the same accuracy but it didnt. So I wonder why? Function to break…
Hang Nguyen
  • 367
  • 2
  • 9
16
votes
4 answers

lightgbm how to deal with No further splits with positive gain, best gain: -inf

how to deal with [Warning] No further splits with positive gain, best gain: -inf is there any parameters not suit?
ji jianye
  • 171
  • 1
  • 1
  • 3
15
votes
2 answers

How to implement learning to rank using lightgbm?

I'm trying to set up learning to rank with lightgbm, I have the following dataset with the interactions of the users based on the query: df = pd.DataFrame({'QueryID': [1, 1, 1, 2, 2, 2], 'ItemID': [1, 2, 3, 1, 2, 3], …
Franco Piccolo
  • 6,845
  • 8
  • 34
  • 52
13
votes
3 answers

LightGBM Image Not Found after Mac install

I installed the lightgbm package with pip (version 10.0.1) to my Python lib (version 3.6.3) on macOS Sierra (version 10.12.6), along with the dependencies found in the documentation, including open-mpi, cmake and gcc. However, I keep receiving the…
Louis
  • 185
  • 1
  • 2
  • 12
11
votes
1 answer

How to plot the learning curves in lightgbm and Python?

I have trained a lightgbm model and I would like to plot the learning curves. How can I do that? In Keras for examples history returns the metrics so that I can plot them once training is over. How this task is handled here? My code is the…
user8270077
  • 4,621
  • 17
  • 75
  • 140
11
votes
2 answers

Grid search with LightGBM example

I am trying to find the best parameters for a lightgbm model using GridSearchCV from sklearn.model_selection. I have not been able to find a solution that actually works. I have managed to set up a partly working code: import numpy as np import…
bhaskarc
  • 9,269
  • 10
  • 65
  • 86
1
2 3
44 45