Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 2. Support Vector Machines (SVM)
- # What it does: Draws a line (or hyperplane) that best separates two classes.
- # Use Case: Classifying patients based on gene data.
- from sklearn.svm import SVC
- from sklearn.metrics import classification_report, confusion_matrix
-
- clf = SVC(kernel='linear')
- clf.fit(X_train_scaled, y_train)
- y_pred = clf.predict(X_test_scaled)
-
- print("SVM Confusion Matrix:\n", confusion_matrix(y_test, y_pred))
- print("\nSVM Classification Report:\n", classification_report(y_test, y_pred))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement