Skip to content

The notebook example is not working #19

Description

@jpzhangvincent

I tried to run the notebook example with the following code snippet:

shap_explainer = fasttreeshap.TreeExplainer(lgb_model)
num_leaves = sum(shap_explainer.model.num_nodes) - sum(sum(shap_explainer.model.children_left > 0))
print("Total number of leaves is {}.".format(num_leaves))

But got the error:

AttributeError                            Traceback (most recent call last)
<command-4123838717328114> in <cell line: 2>()
      1 shap_explainer = fasttreeshap.TreeExplainer(lgb_model)
----> 2 num_leaves = sum(shap_explainer.model.num_nodes) - sum(sum(shap_explainer.model.children_left > 0))
      3 print("Total number of leaves is {}.".format(num_leaves))

AttributeError: 'TreeEnsemble' object has no attribute 'num_nodes'

The lightbgm library version is '3.3.5'. Maybe you want to update the notebook correspondingly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions