Closed rowedenny closed 5 years ago
Hi @rowedenny ,
We have added the attribute supportvectors, nsupport, dualcoef , and intercept. We will add the attribute coef in the future. Thanks.
Hi @GODqinbin ,thank you for the quick follow-up.
I have tested, it works on SVC, yet not work on OneClassSVM. Basically, when I save the well-trained model of OneClassSVM and then load it again, python fails.
The error reports as follows, new.load_from_file('./model') Segmentation fault (core dumped)
Would you please check it and fix this?
Hi @rowedenny ,
We tried OneClassSVM and it works fine. Can you share the dataset and the command? Then we can reproduce the problem.
@zeyiwen @GODqinbin When the Python interface was updated in commit af515fac82c0a9e6df692caad865ee78fab84da6, it seems that the thundersvmScikit.py
related code introduced in the commit 27d3707b4fcce59abd5eccf1af6bc42ec94e573b was deleted. Was that an accident?
Hi, @tuomastik
We have reorganized the structure and moved the file thundersvmScikit.py to "python/thundersvm/thundersvm.py". Now you can use the interface by "import thundersvm".
We rename the file by thundersvm.py
for supporting pip install
.
@GODqinbin The issue is that when @zeyiwen renamed the file from thundersvmScikit.py
to thundersvm.py
he also removed the code that you wrote in commit 27d3707b4fcce59abd5eccf1af6bc42ec94e573b, perhaps by accidentally copying the code from an older version. That can be confirmed by comparing the old and new load_from_file()
implementation:
Hi, @tuomastik
Thanks for you feedback! It was an accident... We have updated the file thundersvm.py and it should support the attributes now.
Thank you for the fast reply and fix @GODqinbin and the whole Xtra Computing Group! :pray: I'm happy to help. It was very difficult to notice the error because the change was done at the same time when the file was renamed, which is why GitHub doesn't show the difference between the old and new file.
This should be fixed now.
I saved the well-trained models, and then load the model again to read its attributes, but those attributes are missing.
I have checked the thundersvmScikit.py, it seems that attributes including: supportvectors, nsupport, dualcoef , coef, intercept are all NOT saved.
e.g from thundersvmScikit import from sklearn.datasets import
x,y = load_svmlight_file("../dataset/test_dataset.txt") clf = SVC(verbose=True, gamma=0.5, C=100) clf.fit(x,y) clf.save_to_file('./model')
clf = SVC() clf.load_from_file('./model') clf.nsupport
_Traceback (most recent call last): AttributeError: 'SVC' object has no attribute 'nsupport'_
P.S the svm(s) in scikit-learn save those parameters, so keeping a consistency would be much appreciated.