CostSensitiveClassification
CostSensitiveClassification copied to clipboard
Models cannot be saved and restored
- attempt to save a trained CostSensitiveRandomForestClassifier model using python pickle
- pickle.dump(model,open("m1","wb")) ## works without an error
- m=pickle.load(open("m1","rb")) ## fails with error "AttributeError: 'module' object has no attribute '_tree_class'"
- attempt to save the same model using joblib.dump from sklearn.externals.joblib:
- joblib.dump(model,"m2") ## fails with error "PicklingError: Can't pickle <class costcla.models.cost_tree._tree_class at 0x7f45d8760db8>: it's not found as costcla.models.cost_tree._tree_class"
Is this something where a fix can be expected?
UPDATE: I now tried this with python version 3.5.2 and this seems to work using pickle, while it fails with version 2.7.12 (both tried on Ubuntu 16.04 with the latest versions of all other libraries installed as available with pip --upgrade).
Also, the problem when saving using joblib.dump does not appear when using python version 3.5.2.
So the best workaround here is to use python 3.5.x though it is still odd that this error occurs with 2.7.12.
I do hope so. I have to take time to work on this.
On Tue, Aug 16, 2016 at 1:08 PM, Johann Petrak [email protected] wrote:
Is this something where a fix can be expected?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/albahnsen/CostSensitiveClassification/issues/2#issuecomment-240187618, or mute the thread https://github.com/notifications/unsubscribe-auth/ADcxyE3_r67QZ9f3CbxgiESq-nEXhQp2ks5qgfyFgaJpZM4JOiK5 .