tensorflow/decision-forests

Is there a method like ydf.load_model() to load model get a instance of tfdf.keras.RandomForestModel?

huzhenbang opened this issue · 2 comments

In YDF https://ydf.readthedocs.io/en/latest/tutorial/getting_started/#save-model

'''
Save model
Finally, we use the same model for later use.

model.save("/tmp/my_model")
So we can load the model with:

loaded_model = ydf.load_model("/tmp/my_model")

print(f"This is a {loaded_model.name()} model.")
'''

I don't find a method to load model to get a instance of tfdf.keras.RandomForestModel.

I found when I use dtreeviz to get some visual information I must retrain the model again. This is so frustrating. Is there a better way?

rstz commented

Hi,

due to limitations of the Keras API, it's not possible to obtain the same model after saving and re-loading. I know this is very frustrating, and it's one of the reasons using ydf instead of tfdf can be a good idea. I don't think dtreeviz has support for ydf yet, but adding it should be easy - maybe open a FR in their repository and cc me to it?

Thanks.