File size: 530 Bytes
532c86a
516f621
cb6bb78
 
 
 
 
 
 
 
516f621
 
 
 
67d21e0
516f621
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

from sklearn.svm import SVC
import joblib
from sklearn.metrics import accuracy_score, classification_report

X_train_tfidf = joblib.load('X_train_tfidf.pkl')
X_test_tfidf = joblib.load('X_test_tfidf.pkl')
y_train = joblib.load('y_train.pkl')
y_test = joblib.load('y_test.pkl')

svm_model = SVC(kernel='linear', random_state=42)
svm_model.fit(X_train_tfidf, y_train)
y_pred = svm_model.predict(X_test_tfidf)
accuracy = accuracy_score(y_test, y_pred)
print(f"Accuracy: {accuracy:.4f}")
print(classification_report(y_test, y_pred))