If the class label vector passed to the "fit" method of OneVsRestClassifier has shape (n,1) instead of shape (n,), then really weird results happen. In this example script here, when the fit SVM is asked to predict the labels of 1000 examples, the resulting prediction vector has shape (45000,1), not (1000,) as expected.
I am using the bleeding edge git repository, last updated today. import numpy as np from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import SVC rng = np.random.RandomState([1,2,3]) X = rng.randn(1000,1000) y = rng.randint(0,10,(1000,1)) svm = OneVsRestClassifier(SVC(kernel = 'linear', C = 1.0)).fit(X,y) print svm.predict(X).shape ------------------------------------------------------------------------------ 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
