ArdalanM/pyLightGBM

IOError when calling fit()

Closed this issue · 6 comments

IOError when calling fit()
OS = Windows 10 x64
Cloned and built it just a few hours ago.

est = GBMRegressor(exec_path="O:/Coding/LightGBM/", 
                   config='', 
                   application='regression', 
                   num_iterations=2500, 
                   learning_rate=0.1, 
                   num_leaves=127, 
                   tree_learner='serial', 
                   num_threads=4, 
                   min_data_in_leaf=100, 
                   metric='l2', 
                   feature_fraction=1.0, 
                   feature_fraction_seed=2, 
                   bagging_fraction=1.0, 
                   bagging_freq=0, 
                   bagging_seed=3, 
                   metric_freq=1, 
                   early_stopping_round=0)
est.fit(X, y, test_data=[(X_holdout, y_holdout)])

IOErrorTraceback (most recent call last)
in ()
----> 1 est.fit(X, y, test_data=[(X_holdout, y_holdout)])

C:\Users\ihopethiswillfi\Anaconda2\lib\site-packages\pylightgbm-0.2-py2.7.egg\pylightgbm\models.pyc in fit(self, X, y, test_data)
71 os.system("{} config={}".format(self.exec_path, self.config))
72
---> 73 with open(self.param['output_model'], mode='rb') as file:
74 self.model = file.read()
75

IOError: [Errno 2] No such file or directory: 'c:\users\ihopethiswillfi\appdata\local\temp\tmpksw8jv\LightGBM_model.txt'

Maybe I know why you have this. How huge is your data ?

The input data at the start of the script is 182 MB, but then it's followed by some feature engineering and selection.

Doing X.info() just before calling fit() in the above code results in...

<class 'pandas.core.frame.DataFrame'>
Int64Index: 25742 entries, 0 to 95822
Columns: 217 entries
dtypes: float64(165), int64(52)
memory usage: 42.8 MB

I have 46 GB free space on C:.

Thanks, I will take a look

@ihopethiswillfi, are you able tu run the examples scripts ?

I can raise this error:

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpvnrmgyf1/LightGBM_model.txt'

when the path to lightgbm (exec_path) is not set correctly

Solved it!
I thought the path refered to a folder, but it has to refer to the executable itself.

So this line from the example:
exec_path="~/Documents/apps/LightGBM/lightgbm"

... should look like this on Windows:
exec_path="C:/LightGBM/lightgbm.exe"

Thanks. We will investigate solution for this difficulty, to find a way how to use this wrapper without setting the path, for simplicity.