serengil / chefboost

A Lightweight Decision Tree Framework supporting regular algorithms: ID3, C4.5, CART, CHAID and Regression Trees; some advanced techniques: Gradient Boosting, Random Forest and Adaboost w/categorical features support for Python
https://www.youtube.com/watch?v=Z93qE5eb6eg&list=PLsS_1RYmYQQHp_xZObt76dpacY543GrJD&index=3
MIT License
453 stars 102 forks source link

Module name format issue #59

Open TASHINOV10 opened 1 week ago

TASHINOV10 commented 1 week ago

Hello Serengil,

While working with the Chefboost library and with the CHAID model in particular, I noticed that the module_name variable in the Training.py module is not defined with the proper format.

-Instead of:

module_name = "outputs/rules/rules" 

module_name should be formatted as:

module_name = "outputs.rules.rules" 

The previous configuration was returning the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[9], line 1
----> 1 model = cb.fit(df_train, config, target_label=target_var_name)

File ~/.local/lib/python3.11/site-packages/chefboost/Chefboost.py:275, in fit(df, config, target_label, validation_df, silent)
    272         json_file = "outputs/rules/rules.json"
    273         functions.createFile(json_file, "[\n")
--> 275     trees = Training.buildDecisionTree(
    276         df,
    277         root=root,
    278         file=file,
    279         config=config,
    280         dataset_features=dataset_features,
    281         parent_level=0,
    282         leaf_id=0,
    283         parents="root",
    284         validation_df=validation_df,
    285         main_process_id=process_id,
    286     )
    288 if silent is False:
    289     logger.info("-------------------------")

File ~/.local/lib/python3.11/site-packages/chefboost/training/Training.py:720, in buildDecisionTree(df, root, file, config, dataset_features, parent_level, leaf_id, parents, tree_id, validation_df, main_process_id)
    714         module_name = "outputs/rules/rules.py" 
...
     30 print(spec)

File <frozen importlib.util>:94, in find_spec(name, package)

ModuleNotFoundError: No module named 'outputs/rules/rules'

Now everything seems fine for me. I will appreciate if you can give me some feedback on this matter.

Thank you in advance.

Kind regards,

Iliyan Tashinov

serengil commented 3 days ago

what is your python version?

TASHINOV10 commented 50 minutes ago

3.9.18