I am evaluating TensorFlow Decision Forests code as a replacement for existing code that usesTensorFlow’s BoostedTreesClassifier.
I am running TFDF v0.1.7 on Ubuntu Linux 20.04.2 LTS.
Using the example code in this tutorial as a starting point:
I have been able to train, evaluate, obtain a summary of the model, and save the model successfully using my own data. I have been using tfdf.keras.RandomForestModel() as a starting point.
My problem is getting programmatic access to the different types of variable importances. My understanding is that I should be able to do this by obtaining an inspector from the trained model.
inspector = tfdf_model.make_inspector()
variable_importances = inspector.variable_importances()
The return value of variable_importances()
is a dict as expected, but when I invoke keys(), the only key returned is
NUM_AS_ROOT. Judging from what I have seen in the output from
summary(), I would have expected
NUM_NODES,
SUM_SCORE, and
MEAN_MIN_DEPTH` to be present as well.
Is there something I need to specify to make those statistics accessible from variable_importances()
?
Thanks!
–
P.J. Hinton