text_html_output_1.png
from sklearn import metrics

from sklearn.metrics import classification_report

from sklearn.metrics import classification_report

from sklearn.metrics import classification_report

from sklearn.metrics import classification_report

from sklearn.model_selection import GridSearchCV

from sklearn.model_selection import KFold

from sklearn.svm import SVC

model_linear = SVC(kernel='linear')
model_linear.fit(X_train, y_train)
y_pred = model_linear.predict(X_test)

from sklearn.metrics import classification_report

non_linear_model = SVC(kernel='rbf')
non_linear_model.fit(X_train, y_train)
y_pred = non_linear_model.predict(X_test)

from sklearn.metrics import classification_report

folds = KFold(n_splits=5, shuffle=True, random_state=101)
hyper_params = [{'gamma': [0.01, 0.001, 0.0001], 'C': [1, 10, 100, 1000]}]
model = SVC(kernel='rbf')
model_cv = GridSearchCV(estimator=model, param_grid=hyper_params, scoring='accuracy', cv=folds, verbose=1, return_train_score=True)
model_cv.fit(X_train, y_train)

model = SVC(C=10, gamma=0.001, kernel='rbf')
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print('accuracy', metrics.accuracy_score(y_test, y_pred), '\n')
print('Precision Score :: ', metrics.precision_score(y_test, y_pred, pos_label='positive', average='micro'))
print('Recall Score :: ', metrics.recall_score(y_test, y_pred, pos_label='positive', average='micro'))
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))
print(metrics.confusion_matrix(y_test, y_pred), '\n')