Advertisement
gk231192

Module 9.2 SVM 2

Jul 3rd, 2025
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. # 2. Support Vector Machines (SVM)
  2. # What it does: Draws a line (or hyperplane) that best separates two classes.
  3. # Use Case: Classifying patients based on gene data.
  4.  
  5. from sklearn.svm import SVC
  6. from sklearn.metrics import classification_report, confusion_matrix
  7. clf = SVC(kernel='linear')
  8. clf.fit(X_train_scaled, y_train)
  9. y_pred = clf.predict(X_test_scaled)
  10. print("SVM Confusion Matrix:\n", confusion_matrix(y_test, y_pred))
  11. print("\nSVM Classification Report:\n", classification_report(y_test, y_pred))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement