Questions tagged [lightgbm]

1

votes
0

answer
281

Views

LightGBMError: b'No OpenCL device found'

I want to train LightGBM with GPU on my dataset using Google colaboratory (I also select runtime Python3 and GPU). To do this I used follow chunk of code: !apt-get -qq install --no-install-recommends nvidia-375 !apt-get -qq install --no-install-recommends nvidia-opencl-icd-375 nvidia-opencl-dev op...
Oysiyl
1

votes
1

answer
561

Views

what does the error “Length of label is not same with #data” when I call lightgbm.train

I'm pretty new the LightGBM, and when I try to apply lightgbm.train on my dataset, I got this error: LightGBMError: Length of label is not same with #data I'm not sure where I made a mistake. I tried model = lightgbm.train(params, train_data, valid_sets=test_data, early_stopping_rounds=150, verbose_...
Aries
1

votes
0

answer
46

Views

Is there object importance in LigtGMB?

I know that in CatBoost in Python API there is a possibility to calculate object importance (don't confuse it with feature importance) with get_object_importance method. I would like to know is there a similar option in LightGMB?
doktr
1

votes
1

answer
531

Views

LightGBM- Classification metrics can't handle a mix of binary and continuous targets

I am facing a trouble when I use lightgbm to conduct grid search. lgb_classifer = lgb.LGBMRegressor(random_state=12) grid_lgb = { 'learning_rate': [0.01,0.05], 'num_iterations': [5,10,20]} gbm_lgb = GridSearchCV(estimator =lgb_classifer, param_grid =grid_lgb, scoring = 'recall', cv=3) ---> gbm_...
Rya
1

votes
1

answer
272

Views

Try installing LightGBM with GPU support

I`m followed official guide step-by-step and get to last command (also I build GPU version from https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#linux): pip3 install lightgbm --install=--gpu When I execute this command, got this: /usr/lib/python3/dist-packages/pip/comma...
Oysiyl
1

votes
1

answer
229

Views

Number of trees in multiclass classification in LightGBM

I am using iris dataset to perform multi-class classification using LightGBM. The code snippet is given below: from sklearn import datasets from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from time import time from sklearn.metrics import r2_score, mean_squ...
abhishek jha
1

votes
0

answer
53

Views

When I am printing with verbose_eval or verbose in LGBM or similar, Jupyter notebook starts overwriting the results, any way to solve this?

unless I expand the output cell but then I have to keep scrolling down which defeats the purpose of the autoscroll extension. This is what I mean: It usually output correctly until the ~300th iteration.
Rashan Arshad
1

votes
1

answer
114

Views

Can I interpret doc2vec components?

I am solving a binary text classification problem with corporate filings. Using Doc2Vec embeddings of length 100 with LightGBM is producing great results. However, for this project it would be very valuable to approximate a thematic meaning for at least one of the components. Ideally, this would be...
user216857
1

votes
0

answer
182

Views

Using google ml engine prediction for a sci-kit learn model which needs additional modules

I have my pipeline defined in a separate file model.py class TextSelector(BaseEstimator, TransformerMixin): def __init__(self, field): self.field = field def fit(self, X, y=None): return self def transform(self, X): return X[self.field] class NumberSelector(BaseEstimator, TransformerMixin): def __in...
Harrison
1

votes
0

answer
110

Views

How to plot a decision tree from lightgbm model IN R?

How do you plot a lightgbm decision tree? I have searched everywhere but I could not find a solution. Here is an example of the model: data(agaricus.train, package = 'lightgbm') train
aSRA
1

votes
0

answer
140

Views

Python crashes while running Light gbm with custom loss function

I have been trying to implement a light gbm model with a custom loss function (SMAPE), however when I run it python crashes with the following error Unhandled exception at 0x00007FF841D04E65 (lib_lightgbm.dll) in python.exe: 0xC0000005: Access violation reading location 0x000002624155B500 The lightg...
Dwarkesh23
1

votes
0

answer
114

Views

Partial dependence plots with min/max (interval) and not only average in Python

Good day, I have applied lightGBM algorithm to real estate price data set (85524 observations and 167 features). I want to receive the interaction between year and real estate area size to price. The dependent variable is transformed with log1p to get normal distribution. I have used Python, pdpbox...
Valentas Gruzauskas
1

votes
0

answer
41

Views

Parameters of ligthgbm tweedie

I'm using the tweedie option for the objective parameter of the lightgbm package. According to wikipedia, the tweedie distribution has a free parameter p, but I can't seem to find the way to give it a value. Does anyone know how to do it? What is the value by default?
Jaime o.
1

votes
0

answer
25

Views

How to use LightGBM to fit a function curve?

I want to use LightGBM to fit a function curve,but in the examples of LightGBM's dataset,every record has a label column. I don't know how to create my training dataset and testset.
徐永豪
1

votes
0

answer
41

Views

What evaluation metric to use for LightGBM ranker function

I'm using LGMRanker from LightGBM but not sure what evaluation metric I should be using. Here is my code: import lightgbm as lgb gbm = lgb.LGBMRanker gridParams = { 'learning_rate': [0.005,0.01,0.02], 'max_depth': [5,6,7], 'n_estimators': [100,200], 'num_leaves': [20,30,50] } lgb_grid = GridSearchCV...
H.Z.
1

votes
0

answer
49

Views

Boost Compilation Failed for Installation of LightGBM on Windows: Name clash for '<pC:\boost\boost-build\lib>libboost_atomic.a'

I am trying to install LightGBM GPU version on Windows systems (I am using Anaconda on Windows for Python). I followed the installation guide from the beginning. I have succefully completed the first two tasks: Install the appropriate OpenCL SDK Install MinGW However, I encountered error after thi...
Fay Wang
1

votes
1

answer
85

Views

num_leaves selection in LightGBM?

Is there any rule of thumb to initialize the num_leaves parameter in lightgbm. For example for 1000 featured dataset, we know that with tree-depth of 10, it can cover the entire dataset, so we can choose this accordingly, and search space for tuning also get limited. But in lightgbm, how we can rou...
Ankish Bansal
1

votes
0

answer
72

Views

Why Underfitting? Using LGBM Regression Model Modeling Time Series Data

Problem Statement Recently I've been trying to train a regression model for time series data. When I trained on an hourly data point (around 7,000 data points), both models showed OKey results. I did normalization on each feature. then the data pipeline fed into the models. The following picture is...
WY Hsu
1

votes
0

answer
24

Views

LightGBM ignore warning about “boost_from_average”

I use LightGBM model (version 2.2.1). It shows next warning on train: [LightGBM] [Warning] Starting from the 2.1.2 version, default value for the 'boost_from_average' parameter in 'binary' objective is true. This may cause significantly different results comparing to the previous versions of LightGB...
Mikhail_Sam
1

votes
1

answer
453

Views

Problems in LightGBM internals

Can't understand what's going on with LightGBM (Windows platform). Previously I had this algorithm really powerful, but now his performance is so bad. For comparison (default parameters in each algorithm) LightGBM performs according to simple DIFF-metric = (actual - prediction): CatBoostRegressor()...
SpanishBoy
1

votes
1

answer
1.1k

Views

lightgbm.sklearn.LGBMRegressor failed to fit simple line

I'm pretty new with LightGBM and I'm trying to fit simple line via LGBMRegressor. import numpy as np import lightgbm as lgbm xs = np.linspace(0, 10, 30).reshape((-1, 1)) ys = np.linspace(0, 10, 30) reg = lgbm.sklearn.LGBMRegressor() reg.fit(xs, ys) print reg.predict(xs) >>> array([ 0., 0., 0...
Dark_Daiver
1

votes
1

answer
312

Views

Numerical stability of gradient and hessian computation of LightGBM and XGBoost

I am looking into the numerical stability of classification with LightGBM and XGBoost. I believe a good place to start is the computation of the gradient and Hessian. These require computation of a logistic function which in my understanding might become unstable with very small values, as this can...
Simon
1

votes
1

answer
508

Views

Lightgbm with Tweedie

I'm trying to run lightgbm with a Tweedie distribution. I believe this code should be sufficient to see the problem: lgb_train=lgb.Dataset(X_train,y_train,weight=W_train,categorical_feature=cat_features) lgb_test=lgb.Dataset(X_test,y_test,weight=W_test,reference=lgb_train,categorical_feature=cat_fe...
Simon Todd
1

votes
1

answer
535

Views

Cross-validation predictions for lightGBM

Is there a simple way to recover cross-validation predictions from the model built using lgb.cv from lightGBM? I am doing a grid search combined with cross validation. Ultimately I would like to obtain the predictions for each of the defined hold-out folds so I can also stack a few models.
abu
1

votes
1

answer
462

Views

Difference between evaluation metrics and evaluation function in lightgbm

Refer to lightgbm.cv, there are two parameters confusing me: metrics and feval. Based on my little knowledge on gbdt, evaluation metrics and evaluation function are both to compute the loss, such as auc, from a vector of predictions and a vector of true labels. However, metrics and function sound...
Garvey
1

votes
1

answer
184

Views

LightGBM Error - length not same as data

I am using lightGBM for finding feature importance but I am getting error LightGBMError: b'len of label is not same with #data' . X.shape (73147, 12) y.shape (73147,) Code: from sklearn.model_selection import train_test_split import lightgbm as lgb # Initialize an empty array to hold feature import...
stone rock
1

votes
1

answer
0

Views

Using multiple self-defined metrics in LightGBM

Given that we could use self-defined metric in LightGBM and use parameter 'feval' to call it during training. And for given metric, we could define it in the parameter dict like metric:(l1, l2) My question is that how call several self-defined metric at the same time? I cannot use feval=(my_metric1,...
Kid
1

votes
1

answer
0

Views

LightGBM specify multiple metrics

What happens when I train a lightgbm model with multiple metrics? I set 3 metrics and it turns out the best iteration result as above. But as you can see, even comparing with the last iteration, it does not seem to be the best result. I have check lightgbm documentation, and it only says the algo wo...
MJeremy
1

votes
1

answer
0

Views

Attribute error : Module “lightgbm” has no attribute “LGBMClassifier” and “Dataset”

I installed lightgbm(2.2.3) using pip version 16.0.0 and got error while uploading the dataset .Code shown below: import lightgbm as gbm d_train=gbm.Dataset(train_x,label=train_y) File 'lightgbm.py', line 13, in import lightgbm as gbm File 'S:\MP pillai meet\Minor Project\ml-challenge-6-v1\ml-chal...
Harsh Patel
0

votes
0

answer
2

Views

How to install mmlspark on local windows machine?

I have installed pyspark on windows on my local machine. Everything works well. I want to install mmlspark (I want to use lightgbm). Anybody can kindly show me some detailed steps? I read the official document. https://azuremlbuild.blob.core.windows.net/pysparkapi/install.html But I don't still ge...
Yunshen Long
1

votes
1

answer
1.8k

Views

Scikit Learn Predicting a Single Observation

This is probably a really stupid question, but why do the following give different results? X == array([ 7.84682988e-01, 3.80109225e-17, 8.06386582e-01, 1.00000000e+00, 5.71428571e-01, 4.44189342e+00]) model.predict_proba(X)[1] # gives array([ 0.35483244, 0.64516756]) model.predict_proba(X...
ndrue
1

votes
1

answer
1.5k

Views

LightGBM: Sklearn and Native API equivalence

I'm experimenting LightGBM through Training API http://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api and Scikit-learn API http://lightgbm.readthedocs.io/en/latest/Python-API.html#scikit-learn-api. I've not been able to make a clear mapping between both API as highlighted in example...
dokteurwho
1

votes
1

answer
680

Views

python LightGBM text classicication with Tfidf

I'm trying to introduce LightGBM for text multiclassification. 2 columns in pandas dataframe, where 'category' and 'contents' are set as follows. Dataframe: contents category 1 this is example1... A 2 this is example2... B 3 this is example3... C *Actual data fr...
SY9
1

votes
1

answer
286

Views

LightGBM: loading from json

I am trying to load a LightGBM.Booster from a JSON file pointer, and can't find an example online. import json ,lightgbm import numpy as np X_train = np.arange(0, 200).reshape((100, 2)) y_train = np.tile([0, 1], 50) tr_dataset = lightgbm.Dataset(X_train, label=y_train) booster = lightgbm.train({}, t...
Sam Shleifer
1

votes
1

answer
39

Views

How to change LightGBM Parameters when it is running?

So, I want to either change the parameter of LightGBM after it is running or After running 10000 times, I want to add another model with different parameters but use the previously trained model. Something like this: params = { 'objective' : 'regression', 'metric' : 'mae', 'num_leaves' : 35, 'le...
John Doe
1

votes
1

answer
68

Views

Why can't I match LGBM's cv score?

I'm unable to match LGBM's cv score by hand. Here's a MCVE: from sklearn.datasets import load_breast_cancer import pandas as pd from sklearn.model_selection import train_test_split, KFold from sklearn.metrics import roc_auc_score import lightgbm as lgb import numpy as np data = load_breast_cancer()...
EuRBamarth
1

votes
0

answer
5

Views

LightGBM - sklearnAPI vs training and data structure API and lgb.cv vs gridsearchcv/randomisedsearchcv

What are the differences between the sklearnAPI(LGBMModel, LGBMClassifier etc) and default API(lgb.Dataset, lgb.cv, lgb.train) of lightgbm? Which one should I prefer using? Is it better to use lgb.cv or gridsearchcv/randomisedsearchcv of sklearn when using lightgbm?
Sift
5

votes
2

answer
1.9k

Views

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
7

votes
1

answer
4.7k

Views

Python: LightGBM cross validation. 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 doesn't support early stopping or lgb.Dataset. import...
Marius
4

votes
5

answer
4k

Views

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 from .basic import Booster, Dataset File '/usr/local/lib/python...
LampShade

View additional questions