I'm trying to use sklearn wrapper LGBMClassifier class in python. Shapes and types of datasets:
print(type(train_x))
train_x.shape
<class 'pandas.core.frame.DataFrame'> (3125, 18)
print(type(train_y))
train_y.shape
<class 'pandas.core.series.Series'> (3125,)
from lightgbm import LGBMClassifier
lgbm_wrapper = LGBMClassifier(n_estimators=400, learning_rate=0.1, random_state=123)
lgbm_wrapper.fit(train_x, train_y, verbose=True, eval_metric="logloss")
It gives me an attribute error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-74f8c97dd31f> in <module>()
2
3 lgbm_wrapper = LGBMClassifier()
----> 4 lgbm_wrapper.fit(train_x, train_y, verbose=True, eval_metric="logloss")
8 frames
/usr/local/lib/python3.6/dist-packages/lightgbm/basic.py in c_str(string)
110 def c_str(string):
111 """Convert a Python string to C string."""
--> 112 return ctypes.c_char_p(string.encode('utf-8'))
113
114
AttributeError: 'tuple' object has no attribute 'encode'
What does this mean? I'm running this in a Google colab documentation, but should I install other utilities to get my work done?
Can you share the dtypes of the pandas dataframe
train_x.dtypes
train_y.dtypes
I have a feeling one of the features in your dataframe is a tuple?