How to save Compact Prediction Tree (CPT) model

Hi guys,

I’m referring to this blog: https://www.analyticsvidhya.com/blog/2018/04/guide-sequence-prediction-using-compact-prediction-tree-python/#comment-152880

and this Git repository: https://github.com/analyticsvidhya/CPT

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)
in
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!
Cheers
Lasse

© Copyright 2013-2019 Analytics Vidhya