lightgbm.sklearn.LGBMRegressor无法适应简单的线条

时间:2017-10-09 13:16:50

标签: python python-2.7 machine-learning regression lightgbm

我对LightGBM很新,我试图通过LGBMRegressor来设置简单的线条。

import numpy as np
import lightgbm as lgbm
xs = np.linspace(0, 10, 30).reshape((-1, 1)) 
ys = np.linspace(0, 10, 30)    
reg = lgbm.sklearn.LGBMRegressor()
reg.fit(xs, ys) 
print reg.predict(xs)
>>> array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
    0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
    0.,  0.,  0.,  0.])

我做错了什么?也许我需要更多功能?

My LightGBM版本是2.0.7(来自github源码),python版本是2.7.12

PS抱歉我的英语不好

1 个答案:

答案 0 :(得分:1)

设置参数min_data_in_leaf = 1,min_data_in_bin = 1.