LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

[python package]: ignore_column support

Open j-mark-hou opened this issue 9 years ago • 2 comments

Does the python package currently have support for the ignore_column option? I can't seem to find it.

Based on the param_dict_to_str() function, it seems like putting something in params might work, but it doesn't:

import lightgbm as lgb
import numpy as np
import pandas as pd

n= 100
X = np.random.normal(size=(n,2))
y = np.random.normal(size=n)
ds = lgb.Dataset(X, y)

# 1. don't ignore anything
params = {'objective':'regression_l2',  'metric':'rmse'}
gbm = lgb.train(params, ds,num_boost_round=10, valid_sets=[ds])

# 2. try and ignore the first column
params = {'objective':'regression_l2',  'metric':'rmse', 'ignore_column':'0'}
gbm = lgb.train(params, ds,num_boost_round=10, valid_sets=[ds])

# 3. try a different way of ignoring column
params = {'objective':'regression_l2',  'metric':'rmse', 'ignore_column':[0]}
gbm = lgb.train(params, ds,num_boost_round=10, valid_sets=[ds])

# The same output is produced in each of these cases.

j-mark-hou avatar Aug 02 '17 22:08 j-mark-hou

@j-mark-hou ignore_column only work when input is file. When input is python object, I think it is easy to drop columns by python.

guolinke avatar Aug 03 '17 00:08 guolinke

sounds great, I'll try that.

j-mark-hou avatar Aug 03 '17 00:08 j-mark-hou