Linear Regression Theory Flashcards

1
Q

What is Linear Regression?

A

Linear Regression is a supervised learning algorithm used for predicting a continuous (numerical) output based on one or more input features. It models the relationship between the dependent variable (Y) and independent variable(s) (X) by fitting a straight line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the equation of Linear Regression

A

y = mx + c

where
y=dependent variable
x=independent variable
m=Slope (change in Y per unit increase in X)
c=Intercept (value of Y when X = 0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the basic idea of Linear Regression?

A

The key idea in Linear Regression is to find the optimal values of b0, b1, b2… such that the predicted values y^ align as closely as possible with the actual values y, minimizing the error.

Here slope m will adjust the steepness of the straight line

Intercept c Determines the starting position of the line (where it crosses the Y-axis).

We can find the minimal m and c values by Gradient Descent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 5 key assumptions of Linear Regression?

A

Linearity – The relationship between X and Y is linear.

Independence – Residuals are independent.

Homoscedasticity – Constant variance of residuals.

Normality of Errors – Residuals are normally distributed.

No Multicollinearity – Independent variables are not highly correlated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the cost function used in Linear Regression?

A

Mean Squared Error (MSE)

J(θ)= 1/n ∑ ( y - y^ )2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the two main types of Linear Regression?

A

Simple Linear Regression – One independent variable.

Multiple Linear Regression – More than one independent variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are key evaluation metrics for Linear Regression?

A

MSE (Mean Squared Error)
RMSE (Root Mean Squared Error)
R² Score (Coefficient of Determination)
Adjusted R² (for multiple regression models)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Overfitting and Underfitting?

A

Overfitting: The model learns noise, performs well on training but poorly on new data.

Underfitting: The model is too simple and fails to capture patterns in the data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the Bias-Variance Tradeoff?

A

High Bias = Underfitting
High Variance = Overfitting

The goal is to find a balance between both.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you detect multicollinearity?

A

Variance Inflation Factor (VIF):
If VIF > 5, it indicates high multicollinearity.

Correlation Matrix:
High correlations between independent variables suggest multicollinearity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do outliers affect Linear Regression?

A

They can distort coefficients and predictions by pulling the straight line towards it.

Solutions: Remove outliers, use Robust Regression, or apply Log Transformation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the three types of Gradient Descent?

A

Batch Gradient Descent – Uses the entire dataset for each update.

Stochastic Gradient Descent (SGD) – Updates after each individual data point.

Mini-Batch Gradient Descent – Uses small random batches for updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the purpose of regularization in Linear Regression?

A

Regularization helps prevent overfitting by adding a penalty to the loss function, which reduces the magnitude of the regression coefficients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does Ridge Regression L2 do?

A

Ridge Regression adds an L2 penalty (sum of squared coefficients) to shrink the coefficients, reducing model complexity and preventing overfitting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens when the regularization parameter λ is increased in Ridge Regression?

A

Higher λ → Coefficients shrink more so the model is turns too simple.
High bias, low variance (underfitting risk).

Lower λ → Coefficients remain similar to standard regression, no effect on straight line
Low bias, high variance (overfitting risk

λ = 0 → Ridge Regression becomes ordinary least squares (OLS).

Need to find a balanced λ to find a generalized model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Lasso Regression?

A

Lasso Regression adds an L1 penalty (sum of absolute coefficients) that forces some coefficients to become exactly zero, performing feature selection.

17
Q

What is the importance of coefficients in Linear Regression?

A

They can tell the impact of particular feature in determining the target variable

18
Q

What happens when the regularization parameter λ is increased in Lasso Regression?

A

Higher λ → More coefficients become exactly zero, leading to feature selection.

Lower λ → Less shrinkage, similar to standard regression.

λ = 0 → Lasso Regression becomes ordinary least squares (OLS).