Machine Learning Term Test 2
Machine Learning Term Test 2
MODULE 4
SVMs work by mapping the data into a high-dimensional space and finding a
hyperplane that separates the data points belonging to different classes. This
hyperplane is determined by support vectors, which are the training data points
that lie on or closest to the hyperplane.
MODULE 4 (2 Marks)
a) what is constrained optimization technique
1. Decision Trees:
Decision trees are like a flowchart for making decisions. They ask a series of
"yes" or "no" questions about your data to figure out which group it belongs to.
Each question splits the data into smaller groups, and the answers lead to
different branches.
1. Linear SVM
2. Non-Linear SVM
1. Separates the two classes of data points in such a way that the distance
between the hyperplane and the nearest data points (called support
vectors) from either class is maximized.
2. Ensures that this margin is as wide as possible, which helps in improving
the generalization of the classifier.
Key Concepts:
● Support Vectors: These are the data points that are closest to the
hyperplane. They are critical in defining the position and orientation of the
maximal margin hyperplane.
Support vectors in a two-class dataset are the data points that lie closest
to the decision boundary. They are crucial in determining the orientation
and margin of the decision boundary.
In simpler terms, they are the "key" data points that help the machine
learning model distinguish between the two classes.
The kernel trick in SVM is used to handle data that isn’t linearly separable.
Instead of working in the original space, the kernel trick transforms the data
into a higher-dimensional space where it becomes easier to separate the
classes with a straight line (or hyperplane).
The One Against All (OvA) SVM method is a strategy used to extend
Support Vector Machines (SVM) for multiclass classification problems. OvA
involves creating multiple binary classifiers, one for each class.
When making predictions, the class with the highest score from its
respective classifier is selected as the final output. This method is simple to
implement and effective for handling multiple classes, but it can be
computationally intensive.
How It Works:
The One Against One (OvO) method is another approach for extending
Support Vector Machines (SVM) to handle multiclass classification
7
problems. Unlike the One Against All (OvA) method, which trains one
classifier per class, OvO trains a separate classifier for every possible pair
of classes.
How It Works:
Disadvantages:
w1x1+w2x2+…+wnxn+b=0
Where:
MODULE 5 (5 Marks)
Q3) What is Spectral clustering
Key Parameters:
Example:
Key Concepts:
1. Choose kkk: Start by deciding how many clusters (kkk) you want to
create.
2. Initialize centroids: Randomly select kkk points from the dataset as
initial centroids (starting points for the clusters).
3. Assign points to clusters: For each data point, calculate the
distance to each centroid. Assign the point to the cluster with the
nearest centroid.
4. Update centroids: Once all points are assigned to clusters, update
the centroid of each cluster by taking the average of all points in that
cluster.
5. Repeat: Repeat the process of assigning points to clusters and
updating centroids until the centroids stop changing or change very
little. This means the algorithm has converged, and the clusters are
stable.
6. Output: Once the centroids stop moving, the algorithm has found the
final clusters, and each data point is assigned to its nearest cluster.
Advantages of K-means:
Disadvantages of K-means:
Example:
Imagine you have a set of points scattered on a plane, and ε is set to 1.0
(meaning points within a distance of 1.0 from each other will be connected).
For any two points:
How it Works:
● For each data point in the dataset, the algorithm calculates its
distance to all other points.
● If the distance between two points is smaller than the threshold ε, an
edge is created between them in the graph. These edges show which
points are close to each other.
● The graph captures the local structure of the data by connecting
nearby points, forming clusters of connected points.
Advantages:
Disadvantages:
MODULE 6 (5 Marks)
Q8) Explain in detail Principal Component Analysis for Dimension
Reduction
Advantages of PCA:
15
Disadvantages of PCA:
Where:
Benefits of SVD:
Other Applications
Applications of SVD
3. Prevents Overfitting: When a model has too many features, it might learn
noise in the data instead of the actual patterns. This can lead to overfitting,
where the model performs well on training data but poorly on new, unseen
data. Reducing dimensions helps to minimize this risk by focusing on the
most important features.
4. Enhances Visualization: High-dimensional data can be hard to visualize.
Dimension reduction techniques, like PCA, allow us to visualize data in 2D
or 3D, making it easier to spot patterns, clusters, and trends.
5. Eliminates Redundancy: In many datasets, features can be highly
correlated or redundant. Dimension reduction techniques help identify and
remove these redundant features, ensuring that the model focuses on
unique and valuable information.
1. Feature Selection
2. Feature Reduction
Benefits of ISA