Waterfall Charts

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

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

yeah that should work, just import it after installing

from treeinterpreter import treeinterpreter
1 Like