GithubHelp home page GithubHelp logo

Comments (4)

chandubhujang avatar chandubhujang commented on May 20, 2024 1

This issue also exists for objective="count:poisson"

from shap.

Vijesh2 avatar Vijesh2 commented on May 20, 2024

using xgboost (2.0.3) and shap (0.45), I get the following error trace. It seems like it might be related to the same issue.

AttributeError Traceback (most recent call last)
Cell In[32], line 2
1 # Create the SHAP explainer with the model
----> 2 explainer = shap.TreeExplainer(fit_xgb)
4 # Compute SHAP values for the training set
5 shap_values = explainer.shap_values(preprocessed_data)

File c:\n\venv\Lib\site-packages\shap\explainers_tree.py:195, in TreeExplainer.init(self, model, data, model_output, feature_perturbation, feature_names, approximate, link, linearize_link)
193 self.feature_perturbation = feature_perturbation
194 self.expected_value = None
–> 195 self.model = TreeEnsemble(model, self.data, self.data_missing, model_output)
196 self.model_output = model_output
197 #self.model_output = self.model.model_output # this allows the TreeEnsemble to translate model outputs types by how it loads the model

File c:\n\venv\Lib\site-packages\shap\explainers_tree.py:1063, in TreeEnsemble.init(self, model, data, data_missing, model_output)
1061 elif safe_isinstance(model, “xgboost.core.Booster”):
1062 self.original_model = model
-> 1063 self._set_xgboost_model_attributes(
1064 data,
1065 data_missing,
1066 objective_name_map,
1067 tree_output_name_map,
1068 )
1069 elif safe_isinstance(model, “xgboost.sklearn.XGBClassifier”):
…
-> 1873 self.base_score = np.log(self.base_score)
1874 else:
1875 self.base_score = base_score

AttributeError: ‘XGBTreeModelLoader’ object has no attribute ‘base_score’

from shap.

couetilj avatar couetilj commented on May 20, 2024

I am having the same bug for v0.45.0 using the cox loss. Downgrading to v0.44.1 is a temporary solution.

from shap.

MelanWang avatar MelanWang commented on May 20, 2024

Same issue here shap == 0.45.0, pls fix it ASAP! really need it to explain a survival:aft model

from shap.

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.