How to save Compact Prediction Tree (CPT) model

Hi guys,

I’m referring to this blog:

and this Git repository:

My question is: how can I save the trained model? When trying to pickle it, this error comes up:

PicklingError Traceback (most recent call last)
1 # save the model to disk
2 filename = ‘model4.sav’
----> 3 pickle.dump(model4, open(filename, ‘wb’))

PicklingError: Can’t pickle <class ‘main.PredictionTree’>: it’s not the same object as main.PredictionTree

Hope you guys can help me out here. Thanks!

© Copyright 2013-2019 Analytics Vidhya