seuadr
seuadr

Reputation: 143

LightGBM - Module not callable

i am using an online jupyter notebook and want to import LightGBM but i'm running into an issue i don't know how to troubleshoot.

i installed it using the pip install:

pip install lightgbm

and that appeared to work correctly: install info

and i've checked for it in conda list: conda list which shows it.. (yes i've restarted the kernel a number of times) :D

then i imported it:

import lightgbm as lgb

no error - the cell runs fine.

but when i try to call it - i get the error "module not callable"

%%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)

error:

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

TypeError: 'module' object is not callable

i've tried importing it a few different ways, and also changed the name to no avail:

import lightgbm as lgb
import lightgbm
from lightgbm import lightgbm 

not sure what i've done wrong, or what to try next? when i search on the subject the vast majority of problems seem to be related to the successful installation - but (and correct me if i am wrong here?) if it is importing and saying the module is not callable as opposed to there is no module named, that would suggest that it is at least partially installed?

thanks for your time in advance.

Upvotes: 0

Views: 2499

Answers (1)

Bhavya Parikh
Bhavya Parikh

Reputation: 3400

There should be some method after importing lightgbm like from your code i can see you are taking columns so it can be like

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)

Upvotes: 2

Related Questions