1
$\begingroup$

I am using an SVM for mulitclass classification between 3 labels (1,0,-1). I thought this could simply be done by using SVC(decision_function_shape = 'ovr') in my model. I have only just discovered that there exists an Sklearn package that works as follows: sklearn.multiclass.OneVsRestClassifier(estimator, n_jobs=-1)

So my question is, what is the difference between the OneVsRestClassifier() and SVC(decision_function_shape = 'ovr'). And in what scenario could one method or the other yield better accuracy?

The current code for my project is as follows:

X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 0)

    pipe = Pipeline([('sc', preprocessing.MinMaxScaler()), 
                 ('SVM', svm.SVC(decision_function_shape = 'ovr', kernel = 'poly'))])

    candidate_parameters = [{'SVM__C': [1], 
                        'SVM__gamma': [1] }]
clf = GridSearchCV(estimator = pipe, param_grid = candidate_parameters, cv = 5, n_jobs = -1)

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.