From the course: Machine Learning Foundations: Statistics
Fitting a line - Python Tutorial
From the course: Machine Learning Foundations: Statistics
Fitting a line
- [Instructor] When we covered linear regression, I didn't mention two important equations, now it's time to explore them. The linear regression model is an equation that describes a linear relationship. The equation that describes the straight line is y equals mx plus b, and similar to that, our equation which describes the linear equation model is y hat equals beta zero, plus beta one x one. Where beta zero is y-intercept, or value where the line intersects the y-axis, meaning x is equal to zero. And beta one is the slope or the size of the relationship. The beta one shows us the positive or negative relationship between the independent and dependent variables. x represents the value for the independent variable. So to get the predicted value for the dependent variable, y hat, we have to plug the value x in our model. And now when we look at the graph, the point P on the graph shows us the predicted value of y hat at x. We can also represent a linear regression model with the following formula, y equals beta zero plus beta one x one plus epsilon, where the sample points aren't on the line. In this second formula, y represents the real value for the dependent variable at point x and epsilon represents the error caused by the difference between the real and predicted values. The third important equation is called a simple linear regression equation. It is indeed a simple equation, y one hat equals b zero plus b one x one. y one hat is the estimated or predicted value. b zero is the estimate of the regression constant beta zero. And b one is the estimate of the beta one. And x one is the sample data for the independent variable. We'll soon see that error is important because we use it to find the line that best fits through the points.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.