Description
Description
'cross_val_predict' function throws error when estimator is 'OneVsRest Classifier with LinearSVC' and method is 'decision_function'.
Steps/Code to Reproduce
from sklearn.model_selection import cross_val_predict
from sklearn import svm
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiL
5608
abelBinarizer
import numpy as np
x_train = np.random.rand(1000,10)
class_labels_train = np.random.randint(5, size=(1000,1))
mlb = MultiLabelBinarizer()
class_labels_train = mlb.fit_transform(class_labels_train)
svm_est = svm.LinearSVC(C=1.0, penalty='l1', random_state=456, tol=0.000001, dual=False, class_weight='balanced')
svm_est = OneVsRestClassifier(svm_est)
cv_results = cross_val_predict(svm_est, x_train, class_labels_train, method='decision_function')
Expected Results
Actual Results
Versions
Darwin-17.4.0-x86_64-i386-64bit
('Python', '2.7.10 (default, Jul 15 2017, 17:16:57) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]')
('NumPy', '1.14.1')
('SciPy', '1.0.0')
('Scikit-Learn', '0.19.1')