Linear Regression final-1.pptx thbejnnej

mathukiyak44 19 views 19 slides Feb 28, 2025
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

This is best ppt


Slide Content

Introduction to Linear Regression Understanding the Basics and Applications Presented by:Kevin mathukiya Roll no :

Agenda Introduction to Linear Regression Importance and Types of Linear Regression Key Concepts Mathematical Formulas Best Fit Line and Cost Function Gradient Descent Steps to Perform Linear Regression Evaluating Model Performance Applications of Linear Regression Practice Example with Code Advantages and Disadvantages Bibliography

What is Linear Regression? Definition: Linear Regression is a statistical method to model the relationship between a dependent variable and one or more independent variables. Purpose: To predict the value of the dependent variable based on the values of independent variables.

Importance of Linear Regression Simple Prediction: Linear regression predicts outcomes based on input data using a straightforward mathematical formula. Wide Applicability: It's used in science, business, and various other fields due to its versatility. Reliability: Linear regression provides reliable predictions and is quick to train due to its well-understood properties.  

Key concepts Dependent Variable (Y): The outcome we are trying to predict. ​ Independent Variable (X): The predictor or explanatory variable. ​ Linear Relationship: Assumes a straight-line relationship between X and Y. ​ Regression Line: The line that best fits the data points.

Types of Linear Regression Simple Linear Regression: Involves one independent       variable and predicts a continuous outcome. Multiple Linear Regression: Includes multiple        independent variables to predict a continuous outcome. Polynomial Regression: Fits a curve to data by        including polynomial terms in the regression equatio n.  

Mathematical Formulas Simple Linear Regression: y = ß0 + ß1X Multiple Linear Regression: y = ß0 + ß1X1 + ß2X2 + ... + ßnXn Key terms: - y: Dependent variable - X: Independent variable(s) - ß0: Intercept - ß1, ß2, ... , ßn : Slopes

Best Fit Line The best-fit line is a straight line     in linear regression. It shows the relationship between the dependent   variable (Y) and the independent variable (X). Its purpose is to minimize discrepancies between     actual data points and predicted values. Optimal values for the intercept (β0) and slope (β1)   are found to determine this line. Helps understand and predict changes in the dependent     variable with changes in the independent variable.  

Cost Function for Linear Regression Measures the error between predicted and actual values. Formula: J(θ): Cost function, where θ are model parameters. m: Number of training examples. hθ ​(x( i )): Predicted value for input x( i ). y( i ): Actual value for input x( i ). Minimizing J(θ) finds optimal parameters θ for the model.

Gradient Descent An optimization algorithm used to minimize the cost function in machine learning. Adjusts model parameters iteratively to find the best-fit line. Helps in finding the optimal values for the intercept and slope in linear regression.

Steps in Gradient Descent Initialize Parameters: Start with random values for θ0​ and θ1. Compute Gradients: Calculate partial derivatives of the cost function. Update Parameters: Adjust parameters using: α: Learning rate. Repeat: Iterate until the cost function converges.

Steps to Perform Linear Regression

Evaluating Model Performance

Applications

Practice Example with Code Import Libraries: Load necessary libraries. Load Dataset: Read the CSV file into a DataFrame . Define Model: Initialize the Linear Regression model. Prepare Data: Select features (X) and target (y). Split Data: Divide data into training and testing sets. Train Model: Fit the model to the training data. Make Predictions: Predict prices on the test set. Evaluate Model: Calculate Mean Squared Error (MSE) and R² score. Link -- https://colab.research.google.com/drive/1uPdkArZtcgCCFHIUzoB1-IysoLKzJ62B#scrollTo=1cldJVPwyzJm

Advantages & Disadvantages Advantages: Easy to understand and interpret. Quick to train and implement. Provides a clear mathematical relationship between dependent and independent variables. Forms the basis for more complex models. Disadvantages: Assumes a linear relationship which might not always hold. Sensitive to outliers which can skew results. Can overfit with too many features.

Conclusion

Bibliography https://www.ibm.com/topics/linear-regression https://www.geeksforgeeks.org/ml-linear-regression/ https://www.statisticssolutions.com/free-resources/directory-of-statistical-analyses/what-is-linear-regression/

Thank You
Tags