LightGBMError: Multiclass objective and metrics don't match
ansin218 opened this issue · 5 comments
ansin218 commented
Does the library have capabilities to handle continuous target variables? I am trying to pass a variable with 600,000 records with integer values between 0-180 and I stumble upon this:
Traceback (most recent call last):
File "<ipython-input-2-285466e856ff>", line 1, in <module>
runfile('C:/Users/ankurs/nutella.py', wdir='C:/Users/ankurs')
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
execfile(filename, namespace)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/ankurs/nutella.py", line 89, in <module>
churnFeatures = TreeFeatureSelection(x, targetChurn)
File "C:\Users\ankurs\FeatureEngineering.py", line 22, in TreeFeatureSelection
n_iterations = 10, early_stopping = True)
File "C:\Users\ankurs\feature_selector.py", line 311, in identify_zero_importance
early_stopping_rounds = 100, verbose = -1)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\sklearn.py", line 700, in fit
callbacks=callbacks)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\sklearn.py", line 502, in fit
callbacks=callbacks)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\engine.py", line 192, in train
booster = Booster(params=params, train_set=train_set)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\basic.py", line 1487, in __init__
train_set.construct().handle,
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\basic.py", line 985, in construct
categorical_feature=self.categorical_feature, params=self.params)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\basic.py", line 771, in _lazy_init
self.__init_from_np2d(data, params_str, ref_dataset)
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\basic.py", line 835, in __init_from_np2d
ctypes.byref(self.handle)))
File "C:\Users\ankurs\AppData\Local\Continuum\anaconda3\lib\site-packages\lightgbm\basic.py", line 45, in _safe_call
raise LightGBMError(decode_string(_LIB.LGBM_GetLastError()))
LightGBMError: Multiclass objective and metrics don't match
I also tried googling and adding multi_logloss eval metrics to the LGBMClassifier and LGBMRegressor but no luck.
alibaltschun commented
@ansin218 did you find the solutions?
ansin218 commented
@alibaltschun Unfortunately, not yet.
alibaltschun commented
@ansin218 i found the problem,
coz we installing the up to date packages.
try to downgrade lightgbm
pip install --user lightgbm==2.1.1
if still error try to downgrade seaborn too
pip install --user seaborn==0.8.1
ansin218 commented
The first solution itself worked. Thanks a ton, mate!
alibaltschun commented
welcome @ansin218