-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save DBScan Model #650
Comments
Hello @EricCacciavillani , Thank you for your reporting. Yes, I can recognize it. It because pyclustering uses C++ code to get maximum performance (I rewrite some of the algorithms using C++) and not all internal data is transferred back to python, only results. And as a result object cannot be restored. I think this is an issue for almost all algorithms which delegate calculation to C++ implementation. I will investigate the issue and will introduce correction for all clustering algorithms. Still, it would be useful to have a code example, I would like to know the use-case if it is possible. |
Sorry for responding so late was helping a co-worker. from pyclustering.cluster.dbscan import dbscan
import pickle
# Data that has had pca and scaled
scaled = auto_cluster.get_scaled_data()
# Model instance
dbscan_instance = dbscan(scaled, .07865, 8, True)
dbscan_instance.process()
# Save model to dir
file_dir = 'DBScan.pkl'
list_pickle = open(file_dir, 'wb')
pickle.dump(dbscan_instance,list_pickle)
list_pickle.close()
# Load model in
with open(file_dir, 'rb') as handle:
load_model = pickle.load(handle) |
I have supported dumping and loading of the algorithm. The changes are on the branch |
First off thank you so much for writing this package! Been having a blast with it and the documentation is amazing!
I found a bug though when I try to pickle.load the object back from a pickle file and it results in this error.
The text was updated successfully, but these errors were encountered: