Lab Report on Support Vector Machine (SVM)
Lab Report Title: Support Vector Machine (SVM)
Name: Ismat Zerin
ID: 231071034
Semester: 6th
Batch: 32
Course Title: Machine Learning Sessional
Course Code: CSE-3204
Department: Computer Science and Engineering
Name of the Algorithm
Support Vector Machine (SVM)
Theory
Support Vector Machine (SVM) is a supervised machine learning algorithm used for classification
and regression tasks. The main objective of SVM is to find an optimal hyperplane that separates
data points of different classes with the maximum margin. The data points closest to the hyperplane
are called support vectors and play a key role in defining the decision boundary.
For datasets that are not linearly separable, SVM uses kernel functions to transform the data into a
higher-dimensional space, making separation possible. Common kernel functions include Linear and
Radial Basis Function (RBF). SVM is known for its accuracy and robustness in classification
problems.
Code
from sklearn import datasets
from sklearn.model_selection import train_test_split
from [Link] import SVC
from [Link] import accuracy_score
data = datasets.load_iris()
X = [Link]
y = [Link]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
model = SVC(kernel='linear')
[Link](X_train, y_train)
y_pred = [Link](X_test)
print("Accuracy:", accuracy_score(y_test, y_pred))
Discussion
While implementing the Support Vector Machine algorithm, some difficulties were encountered in
selecting the appropriate kernel and tuning parameters such as the regularization value.
Additionally, SVM is sensitive to feature scaling, which required proper data preprocessing. Despite
these challenges, the algorithm achieved accurate and reliable classification results, demonstrating
the effectiveness of SVM for classification tasks.