Mod 3
Mod 3
Aditi Deorukhakar
Characteristic Ridge Regression Lasso Regression
Find a linear regression equation for the following two sets of data:
x y
3 12
5 18
7 24
9 30
line of the form:
y=mx+c
Where:
• c is the y-intercept
Aditi Deorukhakar
x y x̄ = 6 ȳ = 21 x - x̄ y-ȳ (x - x̄) (y - ȳ) (x - x̄)²
3 12 6 21 -3 -9 27 9
5 18 6 21 -1 -3 3 1
7 24 6 21 1 3 3 1
9 30 6 21 3 9 27 9
Least-squares regression is a method that finds a straight line (or a surface in higher
dimensions) that best fits the data by minimizing the total squared difference between the
predicted and actual values.
While it's designed for predicting numbers, it can also be adapted for classification, especially
in binary classification problems.
Even though classification is about predicting categories (like yes/no, spam/not spam), we can
use least-squares regression by:
Aditi Deorukhakar
2. Training the model:
The algorithm finds a line (or boundary) that tries to fit these numerical labels as if they
were continuous values.
3. Making predictions:
For a new input, the model gives a number—possibly between 0 and 1, or even outside
that range.
Example
Let’s say you want to classify emails as spam or not spam. You label spam as 1, not spam as 0.
The regression model is trained to predict values close to these numbers. When a new email
comes in, if the model gives a score like 0.8, you label it as spam. If it gives 0.2, it's not spam.
Pros
• Easy to understand.
Cons
• Can give results outside the expected range (like less than 0 or more than 1).
Find the least square regression line Y= aX + b. Estimate the Y when the value of X equals 10.
x y
0 2
1 3
2 5
3 4
4 6
Aditi Deorukhakar
Write a short note on (a) Multivariate Regression
Aditi Deorukhakar
(b) Regularized Regression.
Aditi Deorukhakar
Write short note on
Support Vector Machine (SVM) is a powerful supervised machine learning algorithm used for
both classification and regression tasks, though it is more commonly used for classification. The
key idea behind SVM is to find the optimal separating boundary (called a hyperplane) that best
divides the dataset into different classes.
If the data is not linearly separable, SVM uses a method called the kernel trick, which
transforms the input features into a higher-dimensional space where a linear separation is
possible. This makes SVM highly flexible and capable of handling complex, non-linear data as
well.
SVM is especially effective in high-dimensional spaces and is often used when the number of
features exceeds the number of samples.
How It Works
• For classification: SVM identifies the boundary (hyperplane) that best separates
different classes. The closest data points to this boundary are called support vectors.
Aditi Deorukhakar
• For regression: SVM tries to fit the best possible line (or surface) within a certain margin,
allowing some flexibility for prediction.
• For non-linear data: SVM uses the kernel trick (like RBF or polynomial kernels) to
transform data into a higher dimension where it becomes linearly separable.
Advantages
• Robust to noise
Disadvantages
• No probabilistic output
Applications
• Face recognition
• Text classification
• Handwriting recognition
• Speech recognition
Aditi Deorukhakar
Find a linear regression equation for the following two sets of data:
x y
5 40
7 120
12 180
16 210
20 240
Write a short note on (a) Multivariate Regression and (b) Regularized Regression.
Aditi Deorukhakar