O'Reilly logo

Mastering Python for Data Science by Samir Madhavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Linear regression

Linear regression is an approach in modeling that helps model the scalar linear relationship between a scalar dependent variable, Y, and an independent variable, X, which can be one or more in value:

Linear regression

Let's try to understand this using an example. The following table shows the list of height and weight of students in a class:

Height (inches)

Weight (pounds)

50

125

58

135

63

145

68

144

70

170

79

165

84

171

75

166

65

160

If we run this through a simple linear regression function, which will be covered in a later chapter, with the weight as a dependent variable, y, and the independent variable, x, which is the height, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required