<jupyter_start><jupyter_text>Building the model<jupyter_code>X = np.array(data.iloc[:,:-1].values)
Y = np.array(data.iloc[:,-1].values)
trainx,testx,trainy,testy = train_test_split(X,Y,test_size=0.2,random_state=0)
# Scaling
sc = StandardScaler()
trainx,testx = sc.fit_transform(trainx),sc.fit_transform(testx)

print("For X : Training : {} ; Testing : {}".format(trainx.shape,testx.shape))
print("\nFor Y : Training : {} ; Testing : {}".format(trainy.shape,testy.shape))

sns.pairplot(data,hue='Outcome')
plt.show()
# RBF Kernel
m=50
accuracy,recall,f1 = [],[],[]
x_axis = [i for i in range(1,m)]
for i in range(1,m):
    svm_c = SVC(kernel='rbf',C=i,gamma='auto')
    svm_c.fit(trainx,trainy)
    y_pred_i = svm_c.predict(testx)
    accuracy.append(accuracy_score(testy,y_pred_i))
    recall.append(recall_score(testy,y_pred_i))
    f1.append(f1_score(testy,y_pred_i))
    print("For C = {},".format(i),"confusion matrix : \n",confusion_matrix(testy,y_pred_i),"\n")
plt.figure(figsize=(20,10))
plt.plot(x_axis,accuracy,color='red',marker='o',label='Accuracy')
plt.plot(x_axis,recall,color='blue',marker='x',label='Recall score')
plt.plot(x_axis,f1,color='green',marker='x',label='F1 score')
plt.legend()
plt.xlabel("Value of C")
plt.ylabel("Metric score")
plt.title("Comparison plot")
plt.show()
print("METRIC : ACCURACY\nHighest accuracy is obtained for C = {}, and the accuracy is = {}".format(np.argmax(accuracy)+1,accuracy[np.argmax(accuracy)]))
print("\nMETRIC : RECALL SCORE\nHighest accuracy is obtained for C = {}, and the accuracy is = {}".format(np.argmax(recall)+1,accuracy[np.argmax(recall)]))
print("\nMETRIC : F1 SCORE\nHighest accuracy is obtained for C = {}, and the accuracy is = {}".format(np.argmax(f1)+1,accuracy[np.argmax(f1)]))<jupyter_output>METRIC : ACCURACY
Highest accuracy is obtained for C = 1, and the accuracy is = 0.8051948051948052

METRIC : RECALL SCORE
Highest accuracy is obtained for C = 14, and the accuracy is = 0.7792207792207793

METRIC : F1 SCORE
Highest accuracy is obtained for C = 20, and the accuracy is = 0.7922077922077922
{'fraction_non_alphanumeric': 0.17334620956059874, 'fraction_numerical': 0.039111540318686626, 'mean_word_length': 6.426523297491039, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '163890', 'license': 'MIT', 'n_tokens_mistral': 872, 'n_tokens_neox': 813, 'n_words': 148, 'path': 'svm-diabetes.ipynb', 'repo_name': 'BALaka-18/SVM-Series', 'size': '2071'}