From the course: Applied Machine Learning: Supervised Learning
What is linear regression?
From the course: Applied Machine Learning: Supervised Learning
What is linear regression?
- [Instructor] Linear regression is one of the most important algorithms that you'll be using when you're working with data. And you probably worked with linear regression or something very similar to it when you're in high school or junior high. You might remember the equation y = mx + b, where your math teacher gave you two points and wanted you to figure out what the line was that connected those, and linear regression is just taking that to the next level. Rather than having two points, we might have multiple points. And rather than having two dimensions, X and Y, we might have multiple dimensions. And our goal is to fit a line that fits in those dimensions. So, while you might have worked at this with two points, what linear regression is doing is an algorithm called gradient descent that takes a bunch of points and fits line to it. After performing gradient descent, you will have the slope and an intercept, and this generalizes to multiple features. So, we've talked about how the data is laid out. For machine learning problems typically, you have this capital X thing, which is an array, and each column represents a feature and each row represents a sample. So you can think of each of those columns in X as a feature that we can use, and we can get a weight for each of those features. And the weight basically represents how much of an impact the feature has. We'll talk a little bit more about that in the later chapter. Essentially, when you do linear regression, you are taking this X array and you are coming up with the weights and the intercept that when you do the linear combination of the weights with each of the features and add the intercept, it will come close to that y value.