From 0beb51cf58f52cdc928d149e3a0e41fadd73b122 Mon Sep 17 00:00:00 2001 From: dipika singhania Date: Mon, 3 Mar 2025 13:54:19 +0530 Subject: [PATCH] Added SVM SVC code To train and print accuracy --- svm/svm_author_id.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/svm/svm_author_id.py b/svm/svm_author_id.py index 35390d60ad6..4c47233ac40 100644 --- a/svm/svm_author_id.py +++ b/svm/svm_author_id.py @@ -22,7 +22,16 @@ ######################################################### ### your code goes here ### +from sklearn.svm import SVC +clf = SVC(kernel='linear') +clf.fit(features_train, labels_train) + +predict_test = clf.predict(features_test) + +accuracy = sum(predict_test == labels_test) / len(labels_test) + +print("Accruacy = ", accuracy) #########################################################