Open jpzhangvincent opened 1 year ago
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.
@jpzhangvincent I just checked and it worked for me on lightgbm v3.3.5. Could you share a full working example of this issue?
I get the same error using lightgbm version 4.0.0
4.0.0
I tried to run the notebook example with the following code snippet:
But got the error:
The lightbgm library version is '3.3.5'. Maybe you want to update the notebook correspondingly.