qlib icon indicating copy to clipboard operation
qlib copied to clipboard

Misleading Error "Please install necessary libs for CatBoostModel."

Open you-n-g opened this issue 3 years ago • 3 comments

🐛 Bug Description

Qlib does not require the installation of packages like CatBoostModel

But the output looks a little misleading.

To Reproduce

Run examples/workflow_by_code.ipynb in jupyter notebook.

Expected Behavior

Successfully run the script without installing CatBoostModel and warning.

Screenshot

image

you-n-g avatar Jul 08 '22 02:07 you-n-g

Maybe we could do something like:

class CatBoostModel:
    def __init__(self):
        try:
            from catboost import ***
        except ModuleNotFoundError:
            print("Warning.")

But I feel like this is not elegant enough and may be regarded as invalid in some format style like PEP8. Here could be an alternative: image

Derek-Wds avatar Jul 08 '22 20:07 Derek-Wds

I've debugged the code , it is triggered if catboost is not installed. We can modify the warning to be similar to all other warnings (like when LGBModel or double_ensemble are not available)

I am still new to the library , so any advice would be appreciated.

Edit : path to the screen shot https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/init.py error_location

OussCHE avatar Jul 24 '22 17:07 OussCHE

I think this language support may be useful to make this module cleaner. We can have a unified implementation of __getattr__ to handle all kinds of imports.

https://stackoverflow.com/a/48916205

you-n-g avatar Aug 05 '22 09:08 you-n-g