How to get all the parameters of scikit-learn multiclass SVM classifier?

I have trained my multiclass SVM model for MNIST classification in Python using scikit-learn using the following code:

from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV

parameters = {'kernel':['rbf'], 
              'C':[1, 10, 100, 1000],
              'gamma':[1e-3, 1e-4]}
clf = GridSearchCV(SVC(), parameters)
clf.fit(xtrain, y_train)

 svmclf = clf.best_estimator_
 svmclf.fit(xtrain, y_train)

I wanted to get some parameters of the trained SVM: support vectors, alpha values and bias. So I tried this:

SVs= clf.best_estimator_.support_vectors_
Alpha= clf.best_estimator_._dual_coef_
bias=clf.best_estimator_.intercept_

I checked the shape of these parameters and it gives me this, I don't know if is this correct?

print (SVs.shape)  
(486, 2048)
print (Alpha.shape)
(9, 486)
print (bias.shape)
(45,)

Also, how could I save each of these parameters in a file with readable format?

I tried this script :

import numpy
np.savetxt('values.csv', sv, fmt=%d, delimiter=,)

But the stored data was like this format

1.000000000000000000e+00,2.000000000000000000e+00

Topic multiclass-classification scikit-learn svm

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.