LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

LightGBM run error when number of dimensions is more than 90

Open defaultRobot opened this issue 10 years ago • 38 comments

Environment: windows, number of datas: 6.3w I have found one problem: the lightgbm to train data doesn't work when number of dimensions is more than 90. However the number of dimmension is less than 70, the lightgbm can train data and predict data. I can provide datas if needed.

defaultRobot avatar Nov 24 '16 02:11 defaultRobot

This is very strange. Can you provide data? thanks

guolinke avatar Nov 24 '16 03:11 guolinke

Hi @anddelu , that could because of memory was completely used up? could you please pasting the log here.

chivee avatar Nov 24 '16 03:11 chivee

hi, thanks for responsing: environment:memory 8g I have tried to reduce data less than 5M, and found it works. I thought the lightgbm doesn't work beacause it can handle too many datas. the following datas caused the lightgbm stop Attached is datas: the number of dimensions is more than 90 multiclass.txt

the pricture: image

defaultRobot avatar Nov 24 '16 03:11 defaultRobot

@chivee I think data of 63000*90 is very small, it cannot be out of memory.

guolinke avatar Nov 24 '16 03:11 guolinke

@anddelu I try to run: lightgbm.exe data=multiclass.txt valid=multiclass.txt objective=multiclass num_class=5 and it finish successfully. Can you also provide your parameters?

guolinke avatar Nov 24 '16 04:11 guolinke

here are my parameters, based on examples, in the train.conf file: data=multiclass.train valid_data=multiclass.test objective multiclass num_class=5 metric=multi_logloss metric_freq=1 early_stopping=10 num_trees=100 learning_rate=0.05 num_leaves=31

I used your method and find it work, howerever I use more datas to train model, it still shows error: err01

Attached files: training datas & train.conf multiclass.txt train_conf.txt

defaultRobot avatar Nov 24 '16 05:11 defaultRobot

image

I still can success run with your new data and config. BTW the data in your config is not existing, So i change it to multiclass.txt both for training data and validation data.

guolinke avatar Nov 24 '16 05:11 guolinke

thanks for your response. BTW: the name of config file is correct, I just changed its name when upload it because of supported format. Unfortuantely it doesn't work for me. I thougth maybe the lightgbm.exe is the reason.
I have tried to download the new lightgbm and release it(VS 2013 release 64). It still doesn't work. I am very confused so I want to upload it to see if you can meet it again.

I reduce number of dimensions less than 70 and found it could work again. D:\multiclass_classification>lightgbm.exe config=train_conf.txt [LightGBM] [Info] Finished loading parameters [LightGBM] [Warning] Ignoring feature Column_38, only has one value [LightGBM] [Info] Finished loading data in 0.260338 seconds [LightGBM] [Info] Number of data: 62941, number of features: 69 ...... [LightGBM] [Info] Early stopping at iteration 35, the best iteration round is 25 [LightGBM] [Info] 2.871995 seconds elapsed, finished iteration 35 [LightGBM] [Info] Finished training

lightgbm.exe.txt

defaultRobot avatar Nov 24 '16 06:11 defaultRobot

@anddelu i still can run with your exe... BTW, Did you use training data as validation data? if not, can you provide your validation data as well?

guolinke avatar Nov 24 '16 06:11 guolinke

you can try my exe as well. lightgbm.exe.txt

guolinke avatar Nov 24 '16 06:11 guolinke

validation data is not the traning data. Environment: number of dimension more than 90. number of multiclass = 5 I used your lightghm, it still doesn't work by using the First datas and config file multiclass_train.txt multiclass_test.txt train_conf.txt

However I use the Second data(more than first) and config file, the lightgbm of both you and I can work well. I am very really confused. The data is the cause, because the First Data is part of Second Data ? multiclass_train1.txt multiclass_test1.txt train_conf1.txt

defaultRobot avatar Nov 24 '16 07:11 defaultRobot

It actually have one bug. Have fixed: https://github.com/Microsoft/LightGBM/commit/92351659a7f39bed7fe20b67ce4b27f26501cd77

guolinke avatar Nov 24 '16 09:11 guolinke

thanks very much! I have rereleased it when download fixed codes. Now the ligthgbm can work well. Thank you!!!

defaultRobot avatar Nov 24 '16 15:11 defaultRobot

I have this issue. lightgbm freezes - the number of features in my dataset is more than 4000. Please help..

msafi04 avatar Jun 21 '18 03:06 msafi04

@msafi04 are you on the latest LightGBM ? can you also provide more information, like the data, hardward env and so on ?

guolinke avatar Jun 21 '18 04:06 guolinke

Thanks for the response. My data is of shape (4459, 4735), I am using MacBook Pro. Is it because I am not using GPUs. do u want the code? below is the code to train/predict my dataset.

def pred_lgbm(df, target): target = target.astype('int') params = { "objective" : "regression", "metric" : "rmse", "num_leaves" : 30, "learning_rate" : 0.01, "bagging_fraction" : 0.7, "feature_fraction" : 0.7, "bagging_frequency" : 5, "bagging_seed" : 2018, "verbosity" : 3 } Xtrain, Xvalid, ytrain, yvalid = train_test_split(df, target, test_size = 0.2) ltrain = lgbm.Dataset(Xtrain, ytrain) lvalid = lgbm.Dataset(Xvalid, yvalid) watchlist = [ltrain, lvalid] print('Lgbm training..') clf = lgbm.train(params, ltrain, num_boost_round = 1000, valid_sets = watchlist, early_stopping_rounds = 100, verbose_eval = 10) pred = clf.predict(Xvalid, num_iteration = clf.best_iteration) #lgbm.plot_importance(clf) print('RMLSE: ', rmsle(yvalid, pred)) return None

msafi04 avatar Jun 21 '18 04:06 msafi04

@guolinke I reduced the dimension to 2000 plus but still facing the issue..pls help

msafi04 avatar Jun 22 '18 03:06 msafi04

It seems this is not likely to crash. Did you build the package from latest code ?

guolinke avatar Jun 22 '18 03:06 guolinke

I am not sure which is latest code..could you help me give the latest code. thanks

msafi04 avatar Jun 22 '18 03:06 msafi04

refer to https://github.com/Microsoft/LightGBM/tree/master/python-package#install-from-github

guolinke avatar Jun 22 '18 03:06 guolinke