1 / 104

Linear Regression Algorithm | Linear Regression in Python | Machine Learning Algorithm | Edureka

** Machine Learning Training with Python: https://www.edureka.co/python ** <br>This Linear Regression Algorithm tutorial is designed in a way that you learn about the algorithm in depth. This tutorial is designed in a way that in the first part you will learn about the algorithm from scratch with its mathematical implementation, then you will drill down to the coding part and implement linear regression using python. Below are the topics covered in this tutorial: <br><br>1. What is Regression? <br>2. Regression Use-case <br>3. Types of Regression u2013 Linear vs Logistic Regression <br>4. What is Linear Regression? <br>5. Finding best-fit regression line using Least Square Method <br>6. Checking goodness of fit using R squared Method <br>7. Implementation of Linear Regression Algorithm using Python (from scratch) <br>8. Implementation of Linear Regression Algorithm using Python (scikit lib) <br>Check out our playlist for more videos: http://bit.ly/2taym8X

EdurekaIN
Download Presentation

Linear Regression Algorithm | Linear Regression in Python | Machine Learning Algorithm | Edureka

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  2. Linear Regression Algorithm Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  3. Agenda for Today’s Session ▪ What is Regression? ▪ Regression Use-case ▪ Types of Regression – Linear vs Logistic Regression ▪ What is Linear Regression? ▪ Finding best fit regression line using Least Square Method ▪ Checking goodness of fit using R squared Method ▪ Implementation of Linear Regression using Python ▪ Linear Regression Algorithm using Python from scratch ▪ Linear Regression Algorithm using Python (scikit lib) Copyright © 2017, edureka and/or its affiliates. All rights reserved.

  4. “Regression analysis is a form of predictive modelling technique which investigates the relationship between What is Regression? a dependent and independent variable”

  5. Three major uses for regression analysis are ▪ Determining the strength of predictors Uses of Regression ▪ Forecasting an effect, and ▪ Trend forecasting

  6. Basis Linear Regression Logistic Regression Core Concept The data is modelled The probability of some Linear vs Logistic Regression using a straight line obtained event is represented as a linear function of a combination of predictor variables. Used with Continuous Variable Categorical Variable Output/Prediction Value of the variable Probability of occurrence of event Accuracy and measured by loss, R Accuracy, Precision, Recall, Goodness of fit squared, Adjusted R F1 score, ROC curve, squared etc. Confusion Matrix, etc

  7. “Linear Regression is a method to predict dependent variable (Y) based on values of independent variables (X). It can be used for the What isLinear Regression? cases where we want to predict some continuous quantity.”

  8. Linear Regression Selection Criteria ▪ Classification and Regression Capabilities ▪ Data Quality ▪ Computational Complexity ▪ Comprehensible and Transparent

  9. Where is Linear Regression used? ▪ Evaluating Trends and Sales Estimates ▪ Analyzing the Impact of Price Changes ▪ Assessment of risk in financial services and insurance domain

  10. Y Understanding Linear Regression Algorithm Line Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  11. Y Understanding Linear Regression Algorithm Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  12. Y Understanding Linear Regression Algorithm +ve Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  13. Y Understanding Linear Regression Algorithm Dependent Variable -ve X Independent Variable Machine Learning Training with Python www.edureka.co/python

  14. Y Understanding Linear Regression Algorithm Line Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  15. Y Understanding Linear Regression Algorithm Linear Regression Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  16. Y Understanding Linear Regression Algorithm Dependent Variable Observation X Independent Variable Machine Learning Training with Python www.edureka.co/python

  17. Y Understanding Linear Regression Algorithm Regression Line Least Square Method Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  18. Y Understanding Linear Regression Algorithm error Estimated Value Dependent Variable error Actual Value X Independent Variable Machine Learning Training with Python www.edureka.co/python

  19. Y Understanding Linear Regression Algorithm Dependent Variable Minimize the error X Independent Variable Machine Learning Training with Python www.edureka.co/python

  20. Y Understanding Linear Regression Algorithm +ve Relationship Distance X Speed Machine Learning Training with Python www.edureka.co/python

  21. Y Understanding Linear Regression Algorithm y = mx + c Distance Distance travelled in a fixed duration of time X Speed Machine Learning Training with Python www.edureka.co/python

  22. Y Understanding Linear Regression Algorithm Speed of Vehicle y = mx + c Distance X Speed Machine Learning Training with Python www.edureka.co/python

  23. Y Understanding Linear Regression Algorithm y = mx + c Distance m = +ve slope of line X Speed Machine Learning Training with Python www.edureka.co/python

  24. Y Understanding Linear Regression Algorithm y = mx + c Distance c = y - intercept of the line X Speed Machine Learning Training with Python www.edureka.co/python

  25. Y Understanding Linear Regression Algorithm Time -ve Relationship X Speed Machine Learning Training with Python www.edureka.co/python

  26. Y Understanding Linear Regression Algorithm y = - mx + c Time Time taken to travel a fixed distance X Speed Machine Learning Training with Python www.edureka.co/python

  27. Y Understanding Linear Regression Algorithm Speed of Vehicle y = - mx + c Time X Speed Machine Learning Training with Python www.edureka.co/python

  28. Y Understanding Linear Regression Algorithm y = - mx + c Time m = -ve slope of line X Speed Machine Learning Training with Python www.edureka.co/python

  29. Y Understanding Linear Regression Algorithm c = y - intercept of the line y = - mx + c Time X Speed Machine Learning Training with Python www.edureka.co/python

  30. Y Understanding Linear Regression Algorithm Independent Variable Dependent Variable y = mx + c Dependent Variable X Independent Variable Machine Learning Training with Python www.edureka.co/python

  31. Understanding Linear Regression Algorithm ? ? 1 2 3 4 3 4 2 4 Y Dependent Variable 5 4 5 5 3 2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  32. Understanding Linear Regression Algorithm ? ? 1 2 3 4 3 4 2 4 Y Dependent Variable 5 4 5 5 3 2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  33. Understanding Linear Regression Algorithm ? ? 1 2 3 4 3 4 2 4 Y Dependent Variable 5 4 5 5 3 2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  34. Understanding Linear Regression Algorithm ? ? 1 2 3 4 3 4 2 4 Y Dependent Variable 5 4 5 5 mean : ഥ ? mean: ഥ ? 3 18/5 3.6 3 2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  35. Understanding Linear Regression Algorithm ? ? 1 2 3 4 3 4 2 4 Y Dependent Variable 5 4 5 5 ( , ) 3 3.6 3 mean 2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  36. Understanding Linear Regression Algorithm ? ? 1 2 3 4 3 4 2 4 Y Dependent Variable 5 4 5 5 ( , ) 3.6 3 3 mean 2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  37. Understanding Linear Regression Algorithm ? ? 1 2 3 4 y = mx+c 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 m =? (? − ҧ ?)(? − ത ?) ? ? − ҧ ?2 1 X 0 1 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  38. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 1 1 0 2 3 4 5 6 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  39. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? 1 − 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  40. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? 1 − 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  41. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? 1 −3 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  42. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 2 2 0 1 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  43. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 2 − 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  44. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 2 − 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  45. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 2 −3 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  46. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 -1 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  47. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 -1 0 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  48. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 -1 0 1 3 4 2 4 Y Dependent Variable 5 4 5 5 3 3.6 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  49. Understanding Linear Regression Algorithm ? ? 1 2 3 4 ? − ҧ ? -2 -1 0 1 y = mx+c 3 4 2 4 Y Dependent Variable 5 4 2 5 5 3 3.6 3 mean m =? 2 (? − ҧ ?)(? − ത ?) ? ? − ҧ ?2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

  50. Understanding Linear Regression Algorithm ? ? − ത ? ? 1 2 3 4 ? − ҧ ? -2 -1 0 1 3 4 2 4 Y Dependent Variable 5 4 2 5 5 3 3.6 3 3 mean 2 1 X 0 1 2 4 5 6 3 3 Independent Variable Copyright © 2017, edureka and/or its affiliates. All rights reserved. Machine Learning Training with Python www.edureka.co/python

More Related