July 2017
Beginner to intermediate
442 pages
10h 8m
English
In the last experiment, an RBF kernel was used to determine the test accuracy. Here, the cost value is kept constant with respective other kernels but the gamma value has been chosen as 0.1 to fit the model:
#RBF Kernel >>> svm_rbf_fit = SVC(kernel='rbf',C=1.0, gamma=0.1) >>> svm_rbf_fit.fit(x_train,y_train) >>> print ("\nSVM RBF Kernel Classifier - Train Confusion Matrix\n\n",pd.crosstab( y_train,svm_rbf_fit.predict(x_train),rownames = ["Actuall"],colnames = ["Predicted"])) >>> print ("\nSVM RBF Kernel Classifier - Train accuracy:",round(accuracy_score( y_train, svm_rbf_fit.predict(x_train)),3)) >>> print ("\nSVM RBF Kernel Classifier - Train Classification Report\n", classification_report(y_train,svm_rbf_fit.predict(x_train))) ...Read now
Unlock full access