Xtra-Computing / thundersvm

ThunderSVM: A Fast SVM Library on GPUs and CPUs
Apache License 2.0
1.57k stars 217 forks source link

Loaded SVM can't predict and is a 'NoneType' object #169

Closed CMobley7 closed 4 years ago

CMobley7 commented 5 years ago

I get the following error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'predict'

when running the code

from thundersvm import SVC
import sklearn.datasets
X, y = sklearn.datasets.make_classification(n_samples=1000)
clf = SVC()
clf.fit(X, y)
clf.save_to_file('model')
clf1 = SVC()
clf1 = clf1.load_from_file('model')
predictions = clf1.predict(X)

It appears that I'm not able to load back in the SVC to clf1.

QinbinLi commented 5 years ago

Hi, @CMobley7

Please replace clf1 = clf1.load_from_file('model') with clf1.load_from_file('model').