'SVC' object has no attribute '_probA'
jayahm opened this issue · 4 comments
Hi,
I got the follwoing error:
~\Anaconda3\lib\site-packages\deslib\base.py in fit(self, X, y)
241 self._setup_label_encoder(y)
242 y_dsel = self.enc_.transform(y_dsel)
--> 243 self._set_dsel(X_dsel, y_dsel)
244
245 # validate the value of k
~\Anaconda3\lib\site-packages\deslib\base.py in _set_dsel(self, X, y)
336 self.n_features_ = X.shape[1]
337 self.n_samples_ = self.DSEL_target_.size
--> 338 self.DSEL_processed_, self.BKS_DSEL_ = self._preprocess_dsel()
339
340 def _set_region_of_competence_algorithm(self):
~\Anaconda3\lib\site-packages\deslib\base.py in _preprocess_dsel(self)
671 in DSEL.
672 """
--> 673 BKS_dsel = self._predict_base(self.DSEL_data_)
674 processed_dsel = BKS_dsel == self.DSEL_target_[:, np.newaxis]
675
~\Anaconda3\lib\site-packages\deslib\base.py in _predict_base(self, X)
695
696 for index, clf in enumerate(self.pool_classifiers_):
--> 697 labels = clf.predict(X)
698 predictions[:, index] = self._encode_base_labels(labels)
699 return predictions
~\Anaconda3\lib\site-packages\sklearn\utils\metaestimators.py in <lambda>(*args, **kwargs)
117
118 # lambda, but not partial, allows help() to work with update_wrapper
--> 119 out = lambda *args, **kwargs: self.fn(obj, *args, **kwargs)
120 # update the docstring of the returned function
121 update_wrapper(out, self.fn)
~\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in predict(self, X)
485 """
486 self._check_is_fitted('predict')
--> 487 return self.best_estimator_.predict(X)
488
489 @if_delegate_has_method(delegate=('best_estimator_', 'estimator'))
~\Anaconda3\lib\site-packages\sklearn\svm\_base.py in predict(self, X)
612 y = np.argmax(self.decision_function(X), axis=1)
613 else:
--> 614 y = super().predict(X)
615 return self.classes_.take(np.asarray(y, dtype=np.intp))
616
~\Anaconda3\lib\site-packages\sklearn\svm\_base.py in predict(self, X)
333 X = self._validate_for_predict(X)
334 predict = self._sparse_predict if self._sparse else self._dense_predict
--> 335 return predict(X)
336
337 def _dense_predict(self, X):
~\Anaconda3\lib\site-packages\sklearn\svm\_base.py in _dense_predict(self, X)
353 X, self.support_, self.support_vectors_, self._n_support,
354 self._dual_coef_, self._intercept_,
--> 355 self._probA, self._probB, svm_type=svm_type, kernel=kernel,
356 degree=self.degree, coef0=self.coef0, gamma=self._gamma,
357 cache_size=self.cache_size)
AttributeError: 'SVC' object has no attribute '_probA'
scikit-learn version '0.24.1'
I tried to downgrade scikit-learn to older versions, but doing that may make the other libraries not work.
Hello,
Without having an example and an explanation of what you were trying to do I cannot help you since the error stack alone is not informative enough. Are you loading a previously saved SVC? Methods saved with different sklearn versions may not be compatible with new ones.
Very sorry for the lack of information. Because I thought it has something to with DESLIB compatibility with scikit learn.
To make it short, actually, I run the code with the latest version of scikit-learn.
But, that error came out.
If I downgrade to an older version, it is okay.
Can you confirm whether deslib is still compatible with the latest version of scikit-learn.
If yes, that means, the root of the problem is the saved SVM model from the older version of scikit-learn and not related to DESlib.
Yes, the library is compatible with scikit-learn=0.24.1
I'm pretty sure your problem is the saved model. It is already known that SVM saved from previous sklearn versions are not compatible with the new ones. You can find some more information about that on stack overflow or even in the sklearn documentation/issues.
I see. I'll check my scikit-learn. Thanks