The notebook example is not working
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
Locate the notebook example that contains the shown TreeExplainer and num_leaves snippet, then reproduce the AttributeError with LightGBM 3.3.5. Update the example so it runs with that version and verify the notebook completes while reporting the total number of leaves.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 566
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from linkedin/FastTreeSHAP
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
linkedin/FastTreeSHAP#37 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
linkedin/FastTreeSHAP#36 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
linkedin/FastTreeSHAP#35 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
linkedin/FastTreeSHAP#34 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
linkedin/FastTreeSHAP#33 · 2 comments ·
All issues in linkedin/FastTreeSHAP
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100