On Sat, Aug 4, 2012 at 3:04 PM, David Montgomery
<[email protected]>wrote:
> I am confused on how to use OvR using the libsvm SVC.
>
> 1) Do I have to have my feature vectors in dense format? from X =
> self.vectorizer.fit_transform(self.corpus) ==> X.todense() Or, is
> sparse OK i.e. X.tocsr()
>
You can use the CSR matrix directly (fortunately!).
> 2) How do fit?
>
> clf = sklearn.multiclass.OneVsRestClassifier(svm.SVC())
> clf.fit(X, Y)
>
> Will this use the libsvm flavor of OvR?
>
OvR will not be performed by libsvm directly but by OneVsRestClassifier,
with SVC as the base classifier.
Unfortunately, this means that the kernel cache is not reused across
classifiers (it could be reused if OvR were implemented at the libsvm
level). One workaround if the entire kernel matrix fits in memory is to use
a precomputed kernel (kernel="precomputed").
HTH,
Mathieu
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general