I have got a simple lgbm dataset:
import lightgbm as lgbm
dataset = lgbm.Dataset(data=X, label=y, feature_name=X.columns.tolist())
Where X is a pandas df, and y a pandas series. I want to access a specific column of X in my custom objective function. But when I try:
data = dataset.get_field('data')
I get this error message:
Traceback (most recent call last):
File "<ipython-input-71-34d27860b9e3>", line 1, in <module>
data = dataset.get_field('data')
File "/Users/***/anaconda3/envs/py3k/lib/python3.6/site-packages/lightgbm/basic.py", line 1007, in get_field
ctypes.byref(out_type)))
File "/Users/***/anaconda3/envs/py3k/lib/python3.6/site-packages/lightgbm/basic.py", line 48, in _safe_call
raise LightGBMError(_LIB.LGBM_GetLastError())
LightGBMError: b'Field not found'
Whereas this works well:
y = dataset.get_field('label')
Thank you!