Linear Regression
Linear Regression
Problem: You are given the following data for a simple linear regression model:
x (Hours Studied) y (Exam Score)
1 50
2 55
3 65
4 70
5 80
Fit a linear regression model using the formula y=β0+β1xy = \beta_0 + \beta_1 xy=β0+β1x. Find the best fit
line and predict the exam score for a student who studies for 6 hours.
Steps to Solve:
1. Understand Linear Regression:
Linear regression tries to model the relationship between two variables by fitting a linear equation to
observed data. The equation of a simple linear regression is:
y=β0+β1x
Where:
y is the dependent variable (exam score).
x is the independent variable (hours studied).
β0 is the y-intercept (the value of y when x=0).
β1 is the slope (the change in y for each one-unit change in x)
These constraints ensure that points from the two classes lie on either side of the decision boundary with a
margin of 1.
Step 4: Finding the Hyperplane
We will use the support vectors (3, 3) and (6, 6) to find the hyperplane.
For the point (3, 3) with label +1: