LightGBM - 模块不可调用

LightGBM - Module not callable

我正在使用在线 jupyter 笔记本并想导入 LightGBM,但我 运行 遇到了一个问题,我不知道如何解决。

我使用 pip install 安装它:

pip install lightgbm

这似乎工作正常:

并且我已经在 conda 列表中进行了检查: 这表明它.. (是的,我已经多次重启内核):D

然后我导入了它:

import lightgbm as lgb

没有错误 - 单元运行正常。

但是当我尝试调用它时 - 我收到错误消息“模块不可调用”

%%time
# LightGBM  data processing - categoricals and ints
cat = ['VehicleType','Gearbox','Brand','FuelType','NotRepaired']
con = ['Price','RegistrationYear','Power','Mileage','RegistrationMonth','NumberOfPictures','PostalCode','days_listed']
lgb_model = lgb(categorical_feature = cat)

错误:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<timed exec> in <module>

TypeError: 'module' object is not callable

我试过用几种不同的方式导入它,也改了名字也无济于事:

import lightgbm as lgb
import lightgbm
from lightgbm import lightgbm 

不确定我做错了什么,或者接下来要尝试什么?当我搜索该主题时,绝大多数问题似乎与成功安装有关 - 但是(如果我在这里错了请纠正我?)如果它正在导入并说模块是不可调用的,而不是没有命名的模块,这表明它至少 部分 安装了?

提前感谢您抽出时间。

导入后应该有一些方法 lightgbm 就像从你的代码中我可以看到你正在使用列所以它可以像

import lightgbm as lgb

cat = ['VehicleType','Gearbox','Brand','FuelType','NotRepaired']
con = ['Price','RegistrationYear','Power','Mileage','RegistrationMonth','NumberOfPictures','PostalCode','days_listed']

lgb.Dataset(data, categorical_feature=cat)