title
Linear Regression Algorithm | Linear Regression in Python | Machine Learning Algorithm | Edureka
description
π₯ Machine Learning Training with Python (Use Code "πππππππππ"): https://www.edureka.co/data-science-python-certification-course
This Linear Regression Algorithm video is designed in a way that you learn about the algorithm in depth. This video 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:
1. What is Regression?
2. Regression Use-case
3. Types of Regression β Linear vs Logistic Regression
4. What is Linear Regression?
5. Finding best-fit regression line using Least Square Method
6. Checking goodness of fit using R squared Method
7. Implementation of Linear Regression Algorithm using Python (from scratch)
8. Implementation of Linear Regression Algorithm using Python (scikit lib)
Check out our playlist for more videos: http://bit.ly/2taym8X
PG in Artificial Intelligence and Machine Learning with NIT Warangal : https://www.edureka.co/post-graduate/machine-learning-and-ai
Post Graduate Certification in Data Science with IIT Guwahati - https://www.edureka.co/post-graduate/data-science-program
(450+ Hrs || 9 Months || 20+ Projects & 100+ Case studies)
Subscribe to our channel to get video updates. Hit the subscribe button above.
#LinearRegressionAlgorithm #LinearRegressionAlgorithmUsingPython #LeastSquareMethod #RsquareMethod
How it Works?
1. This is a 5 Week Instructor led Online Course,40 hours of assignment and 20 hours of project work
2. We have a 24x7 One-on-One LIVE Technical Support to help you with any problems you might face or any clarifications you may require during the course.
3. At the end of the training you will be working on a real time project for which we will provide you a Grade and a Verifiable Certificate!
- - - - - - - - - - - - - - - - -
About the Course
Edurekaβs Machine Learning Course using Python is designed to make you grab the concepts of Machine Learning. The Machine Learning training will provide deep understanding of Machine Learning and its mechanism. As a Data Scientist, you will be learning the importance of Machine Learning and its implementation in python programming language. Furthermore, you will be taught Reinforcement Learning which in turn is an important aspect of Artificial Intelligence. You will be able to automate real life scenarios using Machine Learning Algorithms. Towards the end of the course, we will be discussing various practical use cases of Machine Learning in python programming language to enhance your learning experience.
After completing this Machine Learning Certification Training using Python, you should be able to:
Gain insight into the 'Roles' played by a Machine Learning Engineer
Automate data analysis using python
Describe Machine Learning
Work with real-time data
Learn tools and techniques for predictive modeling
Discuss Machine Learning algorithms and their implementation
Validate Machine Learning algorithms
Explain Time Series and itβs related concepts
Gain expertise to handle business in future, living the present
- - - - - - - - - - - - - - - - - - -
Why learn Machine Learning with Python?
Data Science is a set of techniques that enable the computers to learn the desired behavior from data without explicitly being programmed. It employs techniques and theories drawn from many fields within the broad areas of mathematics, statistics, information science, and computer science. This course exposes you to different classes of machine learning algorithms like supervised, unsupervised and reinforcement algorithms. This course imparts you the necessary skills like data pre-processing, dimensional reduction, model evaluation and also exposes you to different machine learning algorithms like regression, clustering, decision trees, random forest, Naive Bayes and Q-Learning.
For more information, Please write back to us at sales@edureka.co or call us at IND: 9606058406 / US: 18338555775 (toll free).
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
detail
{'title': 'Linear Regression Algorithm | Linear Regression in Python | Machine Learning Algorithm | Edureka', 'heatmap': [{'end': 1014.677, 'start': 981.522, 'weight': 0.758}, {'end': 1082.419, 'start': 1045.204, 'weight': 0.794}, {'end': 1631.388, 'start': 1593.153, 'weight': 1}], 'summary': 'Covers the introduction to linear regression algorithm, its mathematical implementation and coding in python, regression analysis, applications of linear regression in business, calculating regression lines, linear regression analysis, and model evaluation achieving an r square value of 0.63.', 'chapters': [{'end': 98.039, 'segs': [{'end': 81.472, 'src': 'embed', 'start': 25.402, 'weight': 0, 'content': [{'end': 30.646, 'text': "But before we drill down to linear regression algorithm in depth, I'll give you a quick overview of today's agenda.", 'start': 25.402, 'duration': 5.244}, {'end': 38.293, 'text': "So we'll start a session with a quick overview of what is regression as linear regression is one of a type of regression algorithm.", 'start': 30.987, 'duration': 7.306}, {'end': 44.919, 'text': "Once we learn about regression its use case the various types of it next we'll learn about the algorithm from scratch.", 'start': 38.753, 'duration': 6.166}, {'end': 52.465, 'text': "where I'll teach you its mathematical implementation first, then we'll drill down to the coding part and implement linear regression using Python.", 'start': 45.339, 'duration': 7.126}, {'end': 57.613, 'text': "In today's session will deal with linear regression algorithm using least square method,", 'start': 53.149, 'duration': 4.464}, {'end': 65.358, 'text': 'check its goodness of fit or how close the data is to the fitted regression line using the R square method, and then finally,', 'start': 57.613, 'duration': 7.745}, {'end': 70.803, 'text': "what we'll do will optimize it using the gradient decent method in the last part on the coding session.", 'start': 65.358, 'duration': 5.445}, {'end': 77.028, 'text': "I'll teach you to implement linear regression using Python and the coding session would be divided into two parts.", 'start': 71.083, 'duration': 5.945}, {'end': 81.472, 'text': 'The first part would consist of linear regression using Python from scratch.', 'start': 77.408, 'duration': 4.064}], 'summary': 'Introduction to linear regression, including use cases and implementation using python.', 'duration': 56.07, 'max_score': 25.402, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY25402.jpg'}], 'start': 7.771, 'title': 'Introduction to linear regression algorithm', 'summary': 'Introduces linear regression algorithm, its use cases, mathematical implementation, and coding in python using least square method, r square method for goodness of fit, and optimization using gradient descent method, with a session divided into two parts for implementing linear regression from scratch and using scikit-learn.', 'chapters': [{'end': 98.039, 'start': 7.771, 'title': 'Introduction to linear regression algorithm', 'summary': 'Introduces linear regression algorithm, its use cases, mathematical implementation, and coding in python using least square method, r square method for goodness of fit, and optimization using gradient descent method, with a session divided into two parts for implementing linear regression from scratch and using scikit-learn.', 'duration': 90.268, 'highlights': ['The session covers various aspects of linear regression, including its mathematical implementation, coding in Python using least square method, R square method for goodness of fit, and optimization using gradient descent method. The session covers various aspects of linear regression, including its mathematical implementation, coding in Python using least square method, R square method for goodness of fit, and optimization using gradient descent method.', 'The agenda includes a quick overview of regression, its use cases, and the types of regression algorithms. The agenda includes a quick overview of regression, its use cases, and the types of regression algorithms.', 'The coding session is divided into two parts, with the first part focusing on implementing linear regression from scratch and the second part using scikit-learn for Derek implementation of linear regression. The coding session is divided into two parts, with the first part focusing on implementing linear regression from scratch and the second part using scikit-learn for Derek implementation of linear regression.']}], 'duration': 90.268, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY7771.jpg', 'highlights': ['The session covers various aspects of linear regression, including its mathematical implementation, coding in Python using least square method, R square method for goodness of fit, and optimization using gradient descent method.', 'The agenda includes a quick overview of regression, its use cases, and the types of regression algorithms.', 'The coding session is divided into two parts, with the first part focusing on implementing linear regression from scratch and the second part using scikit-learn for Derek implementation of linear regression.']}, {'end': 707.346, 'segs': [{'end': 175.768, 'src': 'embed', 'start': 149.557, 'weight': 3, 'content': [{'end': 153.7, 'text': 'in this, the regression can be used to forecast effects or impact of changes.', 'start': 149.557, 'duration': 4.143}, {'end': 162.567, 'text': 'That is, the regression analysis, help us to understand how much the dependent variable changes with the change in one or more independent variable,', 'start': 154.12, 'duration': 8.447}, {'end': 162.747, 'text': 'fine.', 'start': 162.567, 'duration': 0.18}, {'end': 170.425, 'text': 'For example, you can ask question like how much additional sale income will I get for each thousand dollars spent on marketing?', 'start': 163.362, 'duration': 7.063}, {'end': 172.086, 'text': 'third is trend forecasting.', 'start': 170.425, 'duration': 1.661}, {'end': 175.768, 'text': 'in this, the regression analysis predict trends and future values.', 'start': 172.086, 'duration': 3.682}], 'summary': 'Regression analysis forecasts impact of changes and predicts trends.', 'duration': 26.211, 'max_score': 149.557, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY149557.jpg'}, {'end': 335.709, 'src': 'embed', 'start': 310.453, 'weight': 0, 'content': [{'end': 316.696, 'text': 'you can say that the type of function you are mapping to is the main point of difference between linear and logistic regression.', 'start': 310.453, 'duration': 6.243}, {'end': 320.679, 'text': 'a linear regression Maps a continuous X to a continuous Y.', 'start': 316.696, 'duration': 3.983}, {'end': 325.541, 'text': 'on the other hand, a logistic regression Maps a continuous X to the binary Y.', 'start': 320.679, 'duration': 4.862}, {'end': 330.104, 'text': 'so we can use logistic regression to make category or true, false decisions from the data.', 'start': 325.541, 'duration': 4.563}, {'end': 332.246, 'text': "Fine. So let's move on ahead.", 'start': 330.624, 'duration': 1.622}, {'end': 335.709, 'text': 'next is linear regression selection criteria.', 'start': 332.246, 'duration': 3.463}], 'summary': 'Linear regression maps continuous x to continuous y, while logistic regression maps continuous x to binary y for true/false decisions.', 'duration': 25.256, 'max_score': 310.453, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY310453.jpg'}, {'end': 493.026, 'src': 'embed', 'start': 451.167, 'weight': 1, 'content': [{'end': 454.49, 'text': 'This will give you a line that predicts the upward Trends in the sale.', 'start': 451.167, 'duration': 3.323}, {'end': 460.275, 'text': 'After creating the trend line, the company could use the slope of the lines to focus sale in future months.', 'start': 454.93, 'duration': 5.345}, {'end': 463.615, 'text': 'Next is analyzing the impact of price changes.', 'start': 461.014, 'duration': 2.601}, {'end': 468.576, 'text': 'Well linear regression can be used to analyze the effect of pricing on consumer behavior.', 'start': 464.155, 'duration': 4.421}, {'end': 472.758, 'text': 'For instance, if a company changes the price on a certain product several times,', 'start': 468.937, 'duration': 3.821}, {'end': 482.641, 'text': 'then it can record the quantity itself for each price level and then perform a linear regression with sole quantity as a dependent variable and price as the independent variable.', 'start': 472.758, 'duration': 9.883}, {'end': 489.863, 'text': 'This would result in a line that depicts the extent to which the customer reduce their consumption of the product as the price is increasing.', 'start': 482.981, 'duration': 6.882}, {'end': 493.026, 'text': 'So this result would help us in future pricing decisions.', 'start': 490.243, 'duration': 2.783}], 'summary': 'Using linear regression to predict sales trends and analyze price impact for future sales strategies.', 'duration': 41.859, 'max_score': 451.167, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY451167.jpg'}, {'end': 664.532, 'src': 'embed', 'start': 629.219, 'weight': 4, 'content': [{'end': 630.98, 'text': 'In other words, we have to minimize the error.', 'start': 629.219, 'duration': 1.761}, {'end': 635.483, 'text': 'This was a brief understanding of linear regression algorithm soon.', 'start': 631.72, 'duration': 3.763}, {'end': 637.664, 'text': "We'll jump to its mathematical implementation.", 'start': 635.523, 'duration': 2.141}, {'end': 646.838, 'text': 'All right, but for then, let me tell you this Suppose you draw a graph with speed on the x-axis and distance covered on the y-axis,', 'start': 638.024, 'duration': 8.814}, {'end': 648.219, 'text': 'with the time remaining constant.', 'start': 646.838, 'duration': 1.381}, {'end': 654.164, 'text': 'If you plot a graph between the speed traveled by the vehicle and the distance traveled in a fixed unit of time,', 'start': 648.9, 'duration': 5.264}, {'end': 655.685, 'text': 'then you will get a positive relationship.', 'start': 654.164, 'duration': 1.521}, {'end': 656.245, 'text': 'All right.', 'start': 656.045, 'duration': 0.2}, {'end': 664.532, 'text': 'So suppose the equation of line is y equal MX plus C, then in this case, why is the distance traveled in a fixed duration of time?', 'start': 656.806, 'duration': 7.726}], 'summary': 'Linear regression aims to minimize error; positive relationship between speed and distance.', 'duration': 35.313, 'max_score': 629.219, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY629219.jpg'}], 'start': 98.479, 'title': 'Regression analysis and linear regression applications', 'summary': "Discusses regression analysis, emphasizing its uses in determining predictors' strength, forecasting effects, and trend forecasting. it also explains the applications of linear regression in business, consumer behavior analysis, financial services, and insurance, highlighting its use in evaluating sales trends, price impact analysis, risk assessment, and prediction methodology.", 'chapters': [{'end': 426.02, 'start': 98.479, 'title': 'Regression analysis and linear vs. logistic regression', 'summary': 'Discusses regression analysis, highlighting its uses such as determining the strength of predictors, forecasting effects, and trend forecasting. it delves into the differences between linear and logistic regression, emphasizing their core concepts, uses, and selection criteria.', 'duration': 327.541, 'highlights': ['Regression analysis involves determining the strength of predictors, forecasting effects, and trend forecasting. Regression analysis is used to determine the strength of predictors, forecast effects, and predict trends and future values, offering insights into relationships between variables and their impact on dependent variables.', 'Linear regression maps continuous X to continuous Y, while logistic regression maps continuous X to binary Y, making it suitable for true or false decisions. The core concept of linear regression involves modeling data using a straight line with continuous variables, whereas logistic regression maps data using a sigmoid function with categorical variables, making it suitable for true or false decisions.', 'Linear regression is not suitable for classification models due to the challenge of fitting a straight line to a data set and the need to adjust the threshold with each new data point. Linear regression is not suitable for classification models as it relies on fitting a straight line to a data set, posing challenges in adjusting the threshold for new data points, impacting its effectiveness for classification capabilities.', 'Data quality, computational complexity, and transparency are essential criteria for selecting the linear regression algorithm. Factors such as data quality, computational complexity, and transparency are crucial in selecting the linear regression algorithm, with considerations for how missing values and outliers impact the regression, as well as its computational expense and comprehensibility.']}, {'end': 707.346, 'start': 426.906, 'title': 'Linear regression applications', 'summary': 'Explains the applications of linear regression in business, consumer behavior analysis, financial services, and insurance, highlighting its use in evaluating sales trends, price impact analysis, risk assessment, and prediction methodology.', 'duration': 280.44, 'highlights': ['Linear regression can be used in business to evaluate sales trends and make estimates or forecasts, such as predicting upward trends in sales and focusing future sales based on the trend line slope.', 'It can analyze the effect of pricing on consumer behavior by depicting the extent to which customers reduce their consumption as the price increases, aiding in future pricing decisions.', 'It is utilized in the financial services and insurance domain to analyze risk, for instance, plotting the number of claims per customer against age to guide important business decisions.', 'The chapter provides a brief understanding of linear regression, explaining the relationship between independent and dependent variables, the creation of a regression line, and the goal of minimizing prediction error.', 'It also illustrates positive and negative relationships between variables, emphasizing the mathematical implementation of linear regression through practical examples.']}], 'duration': 608.867, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY98479.jpg', 'highlights': ['Linear regression maps continuous X to continuous Y, while logistic regression maps continuous X to binary Y, making it suitable for true or false decisions.', 'Linear regression can be used in business to evaluate sales trends and make estimates or forecasts, such as predicting upward trends in sales and focusing future sales based on the trend line slope.', 'It can analyze the effect of pricing on consumer behavior by depicting the extent to which customers reduce their consumption as the price increases, aiding in future pricing decisions.', 'Regression analysis involves determining the strength of predictors, forecasting effects, and trend forecasting.', 'The chapter provides a brief understanding of linear regression, explaining the relationship between independent and dependent variables, the creation of a regression line, and the goal of minimizing prediction error.']}, {'end': 1149.964, 'segs': [{'end': 767.081, 'src': 'embed', 'start': 707.966, 'weight': 2, 'content': [{'end': 710.988, 'text': "Now, let's move on and see the mathematical implementation of the things.", 'start': 707.966, 'duration': 3.022}, {'end': 711.689, 'text': 'All right.', 'start': 711.469, 'duration': 0.22}, {'end': 716.26, 'text': 'So we have x equal 1 2 3 4 5.', 'start': 712.319, 'duration': 3.941}, {'end': 717.781, 'text': "Let's plot them on the x-axis.", 'start': 716.261, 'duration': 1.52}, {'end': 720.756, 'text': 'So 0 1 2 3 4 5 6.', 'start': 718.241, 'duration': 2.515}, {'end': 726.083, 'text': 'All right, and we have y as 3 4 2 4 5.', 'start': 720.762, 'duration': 5.321}, {'end': 726.304, 'text': 'All right.', 'start': 726.084, 'duration': 0.22}, {'end': 729.826, 'text': "So let's plot 1 2 3 4 5 on the y-axis.", 'start': 726.865, 'duration': 2.961}, {'end': 732.507, 'text': "Now, let's plot coordinates one by one.", 'start': 730.186, 'duration': 2.321}, {'end': 735.388, 'text': 'So x equal 1 and y equal 3.', 'start': 732.907, 'duration': 2.481}, {'end': 738.973, 'text': 'So we have here x equal 1 and y equal 3.', 'start': 735.388, 'duration': 3.585}, {'end': 740.994, 'text': 'So this is our point 1 comma 3.', 'start': 738.973, 'duration': 2.021}, {'end': 745.315, 'text': 'So similarly we have 1 3 2 4 3 2 4 4 and 5 5.', 'start': 740.994, 'duration': 4.321}, {'end': 746.015, 'text': 'All right.', 'start': 745.315, 'duration': 0.7}, {'end': 747.155, 'text': 'So moving on ahead.', 'start': 746.335, 'duration': 0.82}, {'end': 751.257, 'text': "Let's calculate the mean of X and Y and plot it on the graph.", 'start': 747.435, 'duration': 3.822}, {'end': 751.837, 'text': 'All right.', 'start': 751.597, 'duration': 0.24}, {'end': 757.898, 'text': 'So mean of X is 1 plus 2 plus 3 plus 4 plus 5 divided by 5 that is 3.', 'start': 752.317, 'duration': 5.581}, {'end': 758.139, 'text': 'All right.', 'start': 757.898, 'duration': 0.241}, {'end': 761.439, 'text': 'Similarly mean of Y is 3 plus 4 plus 2 plus 4 plus 5 that is 18.', 'start': 758.499, 'duration': 2.94}, {'end': 766.841, 'text': 'So 18 divided by 5 that is nothing but 3.6.', 'start': 761.439, 'duration': 5.402}, {'end': 767.081, 'text': 'All right.', 'start': 766.841, 'duration': 0.24}], 'summary': 'Mathematical implementation of plotting coordinates and calculating means for x and y with quantifiable data.', 'duration': 59.115, 'max_score': 707.966, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY707966.jpg'}, {'end': 828.003, 'src': 'embed', 'start': 789.508, 'weight': 1, 'content': [{'end': 794.03, 'text': "So let's suppose this is our regression line Y equal MX plus C.", 'start': 789.508, 'duration': 4.522}, {'end': 795.431, 'text': 'Now we have a equation of line.', 'start': 794.03, 'duration': 1.401}, {'end': 801.873, 'text': 'So all we need to do is find the value of M and C, where M equals summation of X minus X bar,', 'start': 795.591, 'duration': 6.282}, {'end': 806.815, 'text': 'multiplied by Y minus Y bar upon the summation of X minus X bar whole square.', 'start': 801.873, 'duration': 4.942}, {'end': 808.036, 'text': "Don't get confused.", 'start': 807.276, 'duration': 0.76}, {'end': 809.316, 'text': 'Let me resolve it for you.', 'start': 808.216, 'duration': 1.1}, {'end': 809.777, 'text': 'All right.', 'start': 809.577, 'duration': 0.2}, {'end': 814.779, 'text': 'So moving on ahead as a part of formula what we are going to do will calculate X minus X bar.', 'start': 810.157, 'duration': 4.622}, {'end': 828.003, 'text': 'So we have X as 1 minus X bar as 3 so 1 minus 3 that is minus 2 next we have X equal to minus its mean 3 that is minus 1.', 'start': 815.479, 'duration': 12.524}], 'summary': 'Regression line equation: y=mx+c, m=sum(x-xΜ)(y-yΜ)/sum(x-xΜ)Β².', 'duration': 38.495, 'max_score': 789.508, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY789508.jpg'}, {'end': 1014.677, 'src': 'heatmap', 'start': 981.522, 'weight': 0.758, 'content': [{'end': 984.683, 'text': 'That is 3.6 equal 1.2 plus C.', 'start': 981.522, 'duration': 3.161}, {'end': 987.704, 'text': 'So what is the value of C that is 3.6 minus 1.2.', 'start': 984.683, 'duration': 3.021}, {'end': 989.685, 'text': 'That is 2.4.', 'start': 987.704, 'duration': 1.981}, {'end': 989.925, 'text': 'All right.', 'start': 989.685, 'duration': 0.24}, {'end': 991.306, 'text': 'So what we had?', 'start': 990.686, 'duration': 0.62}, {'end': 997.708, 'text': 'we had M equals 0.4, C as 2.4 and then finally, when we calculate the equation of regression line,', 'start': 991.306, 'duration': 6.402}, {'end': 1003.03, 'text': 'what we get is y equal 0.4 times of X plus 2.4..', 'start': 997.708, 'duration': 5.322}, {'end': 1004.731, 'text': "So there's the regression line.", 'start': 1003.03, 'duration': 1.701}, {'end': 1005.711, 'text': 'All right.', 'start': 1005.491, 'duration': 0.22}, {'end': 1008.332, 'text': "So there's how you are plotting your points.", 'start': 1006.371, 'duration': 1.961}, {'end': 1009.633, 'text': 'This is your actual point.', 'start': 1008.452, 'duration': 1.181}, {'end': 1010.153, 'text': 'All right.', 'start': 1009.953, 'duration': 0.2}, {'end': 1014.677, 'text': 'Now for given M equals 0.4 and C equal 2.4.', 'start': 1010.854, 'duration': 3.823}], 'summary': 'Regression line equation: y = 0.4x + 2.4, m = 0.4, c = 2.4', 'duration': 33.155, 'max_score': 981.522, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY981522.jpg'}, {'end': 1082.419, 'src': 'heatmap', 'start': 1045.204, 'weight': 0.794, 'content': [{'end': 1053.048, 'text': "So let's plot them on the graph and the line passing through all these predicting point and cutting y-axis at 2.4 is the line of regression.", 'start': 1045.204, 'duration': 7.844}, {'end': 1060.495, 'text': 'Now your task is to calculate the distance between the actual and the predicted value and your job is to reduce the distance.', 'start': 1054.011, 'duration': 6.484}, {'end': 1065.897, 'text': 'All right, or in other words, you have to reduce the error between the actual and the predicted value.', 'start': 1060.875, 'duration': 5.022}, {'end': 1072.441, 'text': 'the line with the least error will be the line of linear regression or regression line, and it will also be the best fit line.', 'start': 1065.897, 'duration': 6.544}, {'end': 1073.041, 'text': 'All right.', 'start': 1072.821, 'duration': 0.22}, {'end': 1075.162, 'text': 'So this is how things work in computer.', 'start': 1073.461, 'duration': 1.701}, {'end': 1079.865, 'text': 'So what it do it performs n number of iteration for different values of M.', 'start': 1075.783, 'duration': 4.082}, {'end': 1082.419, 'text': 'for different values of M.', 'start': 1080.999, 'duration': 1.42}], 'summary': 'Calculate and reduce distance between actual and predicted values in linear regression to find best fit line.', 'duration': 37.215, 'max_score': 1045.204, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1045204.jpg'}, {'end': 1141.656, 'src': 'embed', 'start': 1112.771, 'weight': 0, 'content': [{'end': 1119.678, 'text': "Now that we have calculated the best fit line now, it's time to check the goodness of it or to check how good a model is performing.", 'start': 1112.771, 'duration': 6.907}, {'end': 1123.562, 'text': 'So in order to do that, we have a method called R square method.', 'start': 1120.118, 'duration': 3.444}, {'end': 1131.63, 'text': 'So what is this R square? Well R squared value is a statistical measure of how close the data are to the fitted regression line in general.', 'start': 1124.042, 'duration': 7.588}, {'end': 1134.513, 'text': 'It is considered that a higher squared value model is a good model.', 'start': 1131.67, 'duration': 2.843}, {'end': 1141.656, 'text': 'but you can also have a lower squared value for a good model as well or a higher squared value for a model that does not fit at all.', 'start': 1135.009, 'duration': 6.647}], 'summary': 'R squared measures model goodness, higher value indicates better fit.', 'duration': 28.885, 'max_score': 1112.771, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1112771.jpg'}], 'start': 707.966, 'title': 'Calculating regression lines', 'summary': 'Covers the mathematical implementation of graph plotting, calculation of means for x and y resulting in 3 and 3.6 respectively, and the objective of finding the equation of the regression line. it also explains the calculation of the regression line using the formula y=mx+c, including the steps to find the values of m and c, the prediction of y for given values of x, and the determination of the best fit line using r-squared method.', 'chapters': [{'end': 788.902, 'start': 707.966, 'title': 'Mathematical implementation of graph plotting and regression', 'summary': 'Covers the plotting of coordinates on a graph, calculation of means for x and y, resulting in 3 and 3.6 respectively, and the objective of finding the equation of the regression line using the least square method.', 'duration': 80.936, 'highlights': ['Calculation of mean for Y: 3 + 4 + 2 + 4 + 5 = 18, resulting in a mean of 3.6 The mean for Y is calculated as 18 divided by 5, resulting in a mean of 3.6.', 'Calculation of mean for X: 1 + 2 + 3 + 4 + 5 = 15, resulting in a mean of 3 The mean for X is calculated as 15 divided by 5, resulting in a mean of 3.', 'Plotting the coordinates 1 3, 2 4, 3 2, 4 4, and 5 5 on the graph The specific coordinates 1 3, 2 4, 3 2, 4 4, and 5 5 are plotted on the graph.']}, {'end': 1149.964, 'start': 789.508, 'title': 'Regression line calculation', 'summary': 'Explains the calculation of the regression line using the formula y=mx+c, including the steps to find the values of m and c, the prediction of y for given values of x, and the determination of the best fit line using r-squared method.', 'duration': 360.456, 'highlights': ['The formula Y=MX+C is used to calculate the regression line, with the values of M and C determined by specific calculations. The chapter explains the use of the formula Y=MX+C to calculate the regression line, with the values of M and C determined by specific calculations.', 'The calculation of Y for given values of X, with the predicted values derived for X=1, 2, 3, 4, and 5. The process of calculating the predicted values of Y for given values of X, specifically for X=1, 2, 3, 4, and 5.', 'The explanation of the R-squared method for evaluating the goodness of the model and its statistical measure of how close the data are to the fitted regression line. The chapter explains the R-squared method as a statistical measure of how close the data are to the fitted regression line, used for evaluating the goodness of the model.']}], 'duration': 441.998, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY707966.jpg', 'highlights': ['The R-squared method evaluates the goodness of the model and measures the closeness of data to the fitted regression line.', 'The formula Y=MX+C is used to calculate the regression line, with the values of M and C determined by specific calculations.', 'Calculation of mean for Y: 3 + 4 + 2 + 4 + 5 = 18, resulting in a mean of 3.6.', 'Calculation of mean for X: 1 + 2 + 3 + 4 + 5 = 15, resulting in a mean of 3.', 'Plotting the coordinates 1 3, 2 4, 3 2, 4 4, and 5 5 on the graph.']}, {'end': 1438.689, 'segs': [{'end': 1218.03, 'src': 'embed', 'start': 1175.638, 'weight': 0, 'content': [{'end': 1179.479, 'text': 'So these are point and the line passing through these points are nothing but the regression line.', 'start': 1175.638, 'duration': 3.841}, {'end': 1180.139, 'text': 'All right.', 'start': 1179.919, 'duration': 0.22}, {'end': 1188.802, 'text': 'Now what you need to do is you have to check and compare the distance of actual minus mean versus the distance of predicted minus mean.', 'start': 1180.779, 'duration': 8.023}, {'end': 1189.731, 'text': 'All right.', 'start': 1189.511, 'duration': 0.22}, {'end': 1196.616, 'text': "So basically what you're doing you're calculating the distance of actual value to the mean to distance of predicted value to the mean.", 'start': 1190.412, 'duration': 6.204}, {'end': 1197.997, 'text': 'All right.', 'start': 1197.276, 'duration': 0.721}, {'end': 1205.641, 'text': "so there's nothing but R square and mathematically you can represent R square as summation of y predicted values, minus y bar whole square.", 'start': 1197.997, 'duration': 7.644}, {'end': 1214.067, 'text': 'divided by summation of y, minus y bar whole square, where y is the actual value y P is the predicted value and y bar is the mean value of y.', 'start': 1205.641, 'duration': 8.426}, {'end': 1216.849, 'text': 'that is nothing but 3.6..', 'start': 1214.067, 'duration': 2.782}, {'end': 1218.03, 'text': 'So remember this our formula.', 'start': 1216.849, 'duration': 1.181}], 'summary': 'The regression line is calculated using the r square formula, which is represented as 3.6.', 'duration': 42.392, 'max_score': 1175.638, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1175638.jpg'}, {'end': 1372.404, 'src': 'embed', 'start': 1341.099, 'weight': 2, 'content': [{'end': 1345.122, 'text': 'Fine So the result which will get is approximately equal to 0.3.', 'start': 1341.099, 'duration': 4.023}, {'end': 1346.323, 'text': 'Well, this is not a good fit.', 'start': 1345.122, 'duration': 1.201}, {'end': 1350.666, 'text': 'All right, so it suggests that the data points are far away from the regression line.', 'start': 1346.663, 'duration': 4.003}, {'end': 1351.527, 'text': 'All right.', 'start': 1351.307, 'duration': 0.22}, {'end': 1359.613, 'text': 'So this is how your graph will look like when R square is 0.3 when increase the value of R square to 0.7.', 'start': 1352.628, 'duration': 6.985}, {'end': 1365.297, 'text': "So you'll see that the actual value would lie closer to the regression line when it reaches to 0.9.", 'start': 1359.613, 'duration': 5.684}, {'end': 1372.404, 'text': 'It comes more close and when the value approximately equals to 1 then the actual values lies on the regression line itself.', 'start': 1365.297, 'duration': 7.107}], 'summary': 'R square of 0.3 indicates poor fit; improves to 0.9 for close alignment.', 'duration': 31.305, 'max_score': 1341.099, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1341099.jpg'}, {'end': 1428.461, 'src': 'embed', 'start': 1402.839, 'weight': 3, 'content': [{'end': 1411.001, 'text': 'For example, any field that attempts to predict human behavior, such as psychology, typically has r-squared values lower than around 50%,', 'start': 1402.839, 'duration': 8.162}, {'end': 1415.022, 'text': 'through which you can conclude that humans are simply harder to predict than the physical process.', 'start': 1411.001, 'duration': 4.021}, {'end': 1421.155, 'text': 'Furthermore, if your r-squared value is low but you have statistically significant predicators,', 'start': 1415.831, 'duration': 5.324}, {'end': 1428.461, 'text': 'then you can still draw important conclusion about how changes in the predicator values are associated with the changes in the response value.', 'start': 1421.155, 'duration': 7.306}], 'summary': 'Predicting human behavior in fields like psychology yields r-squared values lower than 50%, indicating the difficulty in prediction. however, statistically significant predictors can still draw important conclusions about the association between predictor and response values.', 'duration': 25.622, 'max_score': 1402.839, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1402839.jpg'}], 'start': 1150.344, 'title': 'Linear regression analysis', 'summary': 'Covers plotting actual and predicted values, calculating predicted values, comparing distances, calculating r square, and discussing implications of low r-squared values in different fields.', 'chapters': [{'end': 1196.616, 'start': 1150.344, 'title': 'Regression line and comparison of actual and predicted values', 'summary': 'Covers the plotting of actual and predicted values on a graph, calculation of predicted values for a given equation, and the comparison of distances of actual and predicted values to the mean.', 'duration': 46.272, 'highlights': ['The chapter covers the plotting of actual and predicted values on a graph, calculation of predicted values for a given equation, and the comparison of distances of actual and predicted values to the mean.', 'The predicted values of Y were calculated as 2.8, 3.2, 3.6, 4.0, 4.4 for the equation Y predicted equals 0.4 times of X plus 2.4 for every X equal 1, 2, 3, 4 and 5.', 'The line passing through the plotted points represents the regression line.', 'The chapter emphasizes comparing the distance of actual minus mean versus the distance of predicted minus mean to assess the accuracy of the regression model.']}, {'end': 1316.787, 'start': 1197.276, 'title': 'Calculation of r square and yp-ybar value', 'summary': 'Explains the calculation of r square using the formula summation of (y predicted - y bar)^2 divided by summation of (y - y bar)^2, with specific examples resulting in y minus y bar values, yp minus y bar values, and yp minus y bar whole square.', 'duration': 119.511, 'highlights': ['The formula for R square is explained as summation of (y predicted - y bar)^2 divided by summation of (y - y bar)^2, with the mean value of y bar being 3.6.', 'Examples of y minus y bar calculations are provided, resulting in values such as -0.6, 0.4, 1.6, 0.4, and 1.4.', 'Calculation of YP minus Y bar values is demonstrated, resulting in values such as -0.8, 0.4, 0, 0.4, and 0.8.', 'The process of obtaining YP minus Y bar whole square values is outlined, resulting in values such as 0.64, 0.16, 0, 0.16, and 0.64.']}, {'end': 1438.689, 'start': 1316.787, 'title': 'Calculation of r square', 'summary': 'Explains the calculation of r square, where a value of 0.3 indicates a poor fit, and discusses the implications of low r-squared values in different fields, such as psychology, and the importance of statistically significant predictors.', 'duration': 121.902, 'highlights': ['The value of R square can be calculated as 1.6 upon 5.2, resulting in a value of approximately 0.3, indicating a poor fit.', 'In fields like psychology, it is expected to have low R-squared values, often lower than 50%, due to the complexity of predicting human behavior.', 'Statistically significant predictors allow drawing important conclusions about the association between changes in predictor values and the response value, regardless of the R-squared value.']}], 'duration': 288.345, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1150344.jpg', 'highlights': ['The chapter covers the plotting of actual and predicted values on a graph, calculation of predicted values for a given equation, and the comparison of distances of actual and predicted values to the mean.', 'The formula for R square is explained as summation of (y predicted - y bar)^2 divided by summation of (y - y bar)^2, with the mean value of y bar being 3.6.', 'The value of R square can be calculated as 1.6 upon 5.2, resulting in a value of approximately 0.3, indicating a poor fit.', 'In fields like psychology, it is expected to have low R-squared values, often lower than 50%, due to the complexity of predicting human behavior.']}, {'end': 1715.266, 'segs': [{'end': 1541.718, 'src': 'embed', 'start': 1512.021, 'weight': 0, 'content': [{'end': 1513.802, 'text': 'So now that we have imported our data.', 'start': 1512.021, 'duration': 1.781}, {'end': 1521.51, 'text': 'So as you can see there are 237 values in the training set so we can find a linear relationship between the head size and the brain weights.', 'start': 1514.602, 'duration': 6.908}, {'end': 1529.279, 'text': "So now what we'll do will collect X and Y the X would consist of the head size values and the Y would consist of brain weight values.", 'start': 1522.131, 'duration': 7.148}, {'end': 1533.243, 'text': "So collecting X and Y let's execute the run.", 'start': 1529.86, 'duration': 3.383}, {'end': 1541.718, 'text': "Done Next what we'll do we need to find the values of B 1 or B naught or you can say M and C.", 'start': 1535.226, 'duration': 6.492}], 'summary': 'Data imported, 237 values in training set, finding linear relationship between head size and brain weights.', 'duration': 29.697, 'max_score': 1512.021, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1512021.jpg'}, {'end': 1631.388, 'src': 'heatmap', 'start': 1584.051, 'weight': 1, 'content': [{'end': 1593.153, 'text': 'So, now that we have our coefficient, so comparing it with the equation y equal MX plus C, you can say that brain weight equals 0.263,', 'start': 1584.051, 'duration': 9.102}, {'end': 1597.134, 'text': 'multiplied by head size plus 325.57..', 'start': 1593.153, 'duration': 3.981}, {'end': 1604.095, 'text': 'So you can say that the value of M here is 0.263 and the value of C here is 325.57.', 'start': 1597.134, 'duration': 6.961}, {'end': 1606.336, 'text': "All right, so there's our linear model.", 'start': 1604.095, 'duration': 2.241}, {'end': 1609.036, 'text': "Now, let's plot it and see graphically.", 'start': 1606.796, 'duration': 2.24}, {'end': 1611.537, 'text': "Let's execute it.", 'start': 1610.716, 'duration': 0.821}, {'end': 1613.657, 'text': 'So this is how our plot looks like.', 'start': 1612.077, 'duration': 1.58}, {'end': 1618.023, 'text': 'This model is not so bad, but we need to find out how good our model is.', 'start': 1614.562, 'duration': 3.461}, {'end': 1625.306, 'text': 'So in order to find it that many methods like root mean square method the coefficient of determination or the R square method.', 'start': 1618.904, 'duration': 6.402}, {'end': 1628.307, 'text': "So in this tutorial, I've told you about R square method.", 'start': 1625.726, 'duration': 2.581}, {'end': 1631.388, 'text': "So let's focus on that and see how good our model is.", 'start': 1628.607, 'duration': 2.781}], 'summary': 'Linear model: brain weight = 0.263*head size + 325.57. evaluating model using r square method.', 'duration': 29.606, 'max_score': 1584.051, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1584051.jpg'}, {'end': 1656.64, 'src': 'embed', 'start': 1634.51, 'weight': 3, 'content': [{'end': 1643.173, 'text': 'All right here SS underscore T is the total sum of Square SS underscore R is the total sum of Square of residuals.', 'start': 1634.51, 'duration': 8.663}, {'end': 1649.614, 'text': 'and R square as the formula is 1 minus total sum of squares upon total sum of square of residuals.', 'start': 1644.008, 'duration': 5.606}, {'end': 1656.64, 'text': "All right next when you execute it, you'll get the value of R square as 0.63, which is pretty very good.", 'start': 1650.034, 'duration': 6.606}], 'summary': 'R square value is 0.63, indicating good fit.', 'duration': 22.13, 'max_score': 1634.51, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1634510.jpg'}, {'end': 1708.201, 'src': 'embed', 'start': 1678.919, 'weight': 4, 'content': [{'end': 1682.74, 'text': 'So using the scikit-learn libraries your code shortens to this length.', 'start': 1678.919, 'duration': 3.821}, {'end': 1691.182, 'text': "All right, so let's execute the run button and see you will get the same R2 score as Well.", 'start': 1683.18, 'duration': 8.002}, {'end': 1693.043, 'text': "this was all for today's discussion.", 'start': 1691.182, 'duration': 1.861}, {'end': 1696.504, 'text': 'in case you have any doubt, feel free to add your query to the comment section.', 'start': 1693.043, 'duration': 3.461}, {'end': 1697.064, 'text': 'Thank you.', 'start': 1696.744, 'duration': 0.32}, {'end': 1700.256, 'text': 'I hope you have enjoyed listening to this video.', 'start': 1698.115, 'duration': 2.141}, {'end': 1708.201, 'text': 'Please be kind enough to like it and you can comment any of your doubts and queries and we will reply them at the earliest.', 'start': 1700.617, 'duration': 7.584}], 'summary': 'Using scikit-learn libraries shortens code length, achieving same r2 score.', 'duration': 29.282, 'max_score': 1678.919, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1678919.jpg'}], 'start': 1439.049, 'title': 'Linear regression and model evaluation', 'summary': 'Focuses on implementing linear regression using python to analyze head size and brain weight, determining coefficients for the linear relationship and achieving an r square value of 0.63 for model evaluation.', 'chapters': [{'end': 1511.42, 'start': 1439.049, 'title': 'Linear regression using python', 'summary': 'Focused on implementing linear regression using python with jupiter notebook, utilizing a data set of 237 rows and four columns to analyze head size and brain weight.', 'duration': 72.371, 'highlights': ['The data set consists of 237 rows and four columns, including gender, age range, head size in centimeter cube, and brain weight in gram.', 'For implementing linear regression using Python, anaconda with Jupiter notebook installed is used.', 'The chapter emphasized the theoretical concept before moving on to the coding part to understand the code in depth.']}, {'end': 1613.657, 'start': 1512.021, 'title': 'Linear relationship analysis: head size and brain weight', 'summary': 'Explores the linear relationship between head size and brain weight, utilizing 237 values in the training set to determine the coefficients as 0.263 for head size and 325.57 for brain weight, and visually representing the linear model through a plot.', 'duration': 101.636, 'highlights': ['The chapter analyzes the linear relationship between head size and brain weight using 237 values in the training set. It mentions the number of values in the training set as 237, indicating the dataset size for analysis.', 'The chapter determines the coefficients for head size and brain weight as 0.263 and 325.57 respectively. It calculates the coefficients for the linear relationship, providing the specific values as 0.263 for head size and 325.57 for brain weight.', 'The chapter visually represents the linear model through a plot. It visually represents the linear model through a plot, allowing for a graphical understanding of the relationship between head size and brain weight.']}, {'end': 1715.266, 'start': 1614.562, 'title': 'R-square method in model evaluation', 'summary': 'Discusses the r square method for evaluating a model, achieving an r square value of 0.63, and implementing the model using the scikit-learn library for simplifying the code and obtaining the same r2 score.', 'duration': 100.704, 'highlights': ['The R square value achieved is 0.63, indicating a relatively good model performance.', 'Implementing the model using the scikit-learn library in Python significantly shortens the code length while maintaining the same R2 score.', "The tutorial emphasizes the use of the R square method for evaluating the model's performance, providing insights into the calculation and significance of the R square value."]}], 'duration': 276.217, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/E5RjzSK0fvY/pics/E5RjzSK0fvY1439049.jpg', 'highlights': ['The data set consists of 237 rows and four columns, including gender, age range, head size in centimeter cube, and brain weight in gram.', 'The chapter visually represents the linear model through a plot, allowing for a graphical understanding of the relationship between head size and brain weight.', 'The chapter determines the coefficients for head size and brain weight as 0.263 and 325.57 respectively.', 'The R square value achieved is 0.63, indicating a relatively good model performance.', 'Implementing the model using the scikit-learn library in Python significantly shortens the code length while maintaining the same R2 score.']}], 'highlights': ['The R square value achieved is 0.63, indicating a relatively good model performance.', 'The session covers various aspects of linear regression, including its mathematical implementation, coding in Python using least square method, R square method for goodness of fit, and optimization using gradient descent method.', 'The coding session is divided into two parts, with the first part focusing on implementing linear regression from scratch and the second part using scikit-learn for Derek implementation of linear regression.', 'Linear regression can be used in business to evaluate sales trends and make estimates or forecasts, such as predicting upward trends in sales and focusing future sales based on the trend line slope.', 'The chapter covers the plotting of actual and predicted values on a graph, calculation of predicted values for a given equation, and the comparison of distances of actual and predicted values to the mean.', 'The formula for R square is explained as summation of (y predicted - y bar)^2 divided by summation of (y - y bar)^2, with the mean value of y bar being 3.6.', 'The data set consists of 237 rows and four columns, including gender, age range, head size in centimeter cube, and brain weight in gram.', 'Regression analysis involves determining the strength of predictors, forecasting effects, and trend forecasting.', 'The chapter visually represents the linear model through a plot, allowing for a graphical understanding of the relationship between head size and brain weight.']}