Coder Social home page Coder Social logo

Comments (10)

interpret-ml avatar interpret-ml commented on June 12, 2024

Hi @anindya5 --

This appears to be a question that's better suited for the interpret-community repo. Transferring it there so they can help you.

-InterpretML

from interpret-community.

rodrigovssp avatar rodrigovssp commented on June 12, 2024

from interpret-community.

imatiach-msft avatar imatiach-msft commented on June 12, 2024

@anindya5 strange, can you do the import manually in your python environment?

from lightgbm import LGBMRegressor, LGBMClassifier, Booster
init_func = LGBMRegressor

Perhaps the import errors are getting suppressed here, do you see anything printed:

with warnings.catch_warnings():
    warnings.filterwarnings('ignore', 'Starting from version 2.2.1', UserWarning)
    import shap
    try:
        from lightgbm import LGBMRegressor, LGBMClassifier, Booster
        import lightgbm
        if (version.parse(lightgbm.__version__) <= version.parse('2.2.1')):
            print("Using older than supported version of lightgbm, please upgrade to version greater than 2.2.1")
    except ImportError:
        print("Could not import lightgbm, required if using LGBMExplainableModel")

from interpret-community.

gaugup avatar gaugup commented on June 12, 2024

@anindya5 is this issue resolved? Are you able to proceed?

Regards

from interpret-community.

gaugup avatar gaugup commented on June 12, 2024

@anindya5, closing this issue since there is no response on this thread. Please feel free to reopen if you continue to run into this error.

Regards

from interpret-community.

nayanaramakanth avatar nayanaramakanth commented on June 12, 2024

Still seeing this issue ? Does anyone has any resolution ?

from interpret-community.

imatiach-msft avatar imatiach-msft commented on June 12, 2024

@nayanaramakanth Sorry about the issue you are having. Do you have lightgbm package installed in your environment? Can you show the output of:

pip show lightgbm

Specifically what version of lightgbm you have?

from interpret-community.

rnavarromatesanz avatar rnavarromatesanz commented on June 12, 2024

Hi,

I'm having the same problem. In my case I'm following this AzureML tutorial.
https://docs.microsoft.com/en-us/azure/machine-learning/how-to-machine-learning-interpretability

And when I try to execute this part:

from interpret.ext.blackbox import MimicExplainer

from lightgbm import LGBMRegressor, LGBMClassifier, Booster
init_func = LGBMRegressor

# you can use one of the following four interpretable models as a global surrogate to the black box model

from interpret.ext.glassbox import LGBMExplainableModel
from interpret.ext.glassbox import LinearExplainableModel
from interpret.ext.glassbox import SGDExplainableModel
from interpret.ext.glassbox import DecisionTreeExplainableModel

# "features" and "classes" fields are optional
# augment_data is optional and if true, oversamples the initialization examples to improve surrogate model accuracy to fit original model.  Useful for high-dimensional data where the number of rows is less than the number of columns.
# max_num_of_augmentations is optional and defines max number of times we can increase the input data size.
# LGBMExplainableModel can be replaced with LinearExplainableModel, SGDExplainableModel, or DecisionTreeExplainableModel
explainer2 = MimicExplainer(model, 
                           x_train, 
                           LGBMExplainableModel, 
                           augment_data=True, 
                           max_num_of_augmentations=10, 
                           features=breast_cancer_data.feature_names, 
                           classes=classes)_

I have the commented error

C:\ProgramData\Anaconda3\lib\site-packages\interpret_community\mimic\models\lightgbm_model.py in __init__(self, multiclass, random_state, shap_values_output, classification, **kwargs)
    173             initializer = LGBMClassifier
    174         else:
--> 175             initializer = LGBMRegressor
    176         self._lgbm = initializer(random_state=random_state, **initializer_args)
    177         super(LGBMExplainableModel, self).__init__(**kwargs)

NameError: name 'LGBMRegressor' is not defined_

Here is the result of "pip show lightgbm"

Name: lightgbm
Version: 3.3.2
Summary: LightGBM Python Package
Home-page: https://github.com/microsoft/LightGBM
Author: None
Author-email: None
License: The MIT License (Microsoft)
Location: c:\programdata\anaconda3\lib\site-packages
Requires: numpy, scipy, wheel, scikit-learn
Required-by:

Thanks in advance for your support

from interpret-community.

rnavarromatesanz avatar rnavarromatesanz commented on June 12, 2024

Hi @nayanaramakanth can you help with this, thanks in advance....

from interpret-community.

imatiach-msft avatar imatiach-msft commented on June 12, 2024

@rnavarromatesanz
can you try doing an import in your python environment manually, eg:

from lightgbm import LGBMRegressor, LGBMClassifier, Booster

this error indicates that this import is just not working for some reason

from interpret-community.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.