I would like to add a waterfall chart for random forest model interpretation as is suggested in Chapter 9 of Howard & Gugger , however, I am encountering an error.
This is the code I am running in Colab:
!pip install -Uqq waterfallcharts
waterfall(valid_xs_tindep.columns, contributions[0], threshold = 0.08, rotation_value=45, formatting='{:,.3f}');
And, this is the error I am getting:
NameError: name 'waterfall' is not defined
Help to resolve this issue is appreciated.
-Simon
1 Like
miwojc
March 22, 2022, 8:36pm
2
this is how fastbook imported the lib:
from waterfall_chart import plot as waterfall
1 Like
Thank you, @miwojc .
DO you know if there is another way I should be installing and importing treeinterpreter
other than this,
!pip install -Uqq fastai waterfallcharts treeinterpreter dtreeviz
, to use it in the following way?
predictions, bias, contributions = treeinterpreter.predict(m, row.values)
1 Like
miwojc
March 23, 2022, 9:12am
4
yeah that should work, just import it after installing
from treeinterpreter import treeinterpreter
1 Like
flintoff1
(ATF Booru)
March 25, 2025, 10:37pm
5
simonvincenthk:
I would like to add a waterfall chart for random forest model interpretation as is suggested in Chapter 9 of Howard & Gugger , however, I am encountering an error.
This is the code I am running in Colab:
!pip install -Uqq waterfallcharts
waterfall(valid_xs_tindep.columns, contributions[0], threshold = 0.08, rotation_value=45, formatting='{:,.3f}');
And, this is the error I am getting:
NameError: name 'waterfall' is not defined
Help to resolve this issue is appreciated.
-Simon
Import the waterfall
function from waterfallcharts
by adding from waterfallcharts import waterfall
before using it in your code.