This chapter starts with defining a simple linear regression method with one variable using Python. Then, it focuses on linear regression with multiple variables. We first show how to obtain the least squares estimation via SymPy. Next, we define a generic function for linear regression with multiple variables. Furthermore, we demonstrate how to call for the linear regression method from scikit-learn in two ways: LinearRegression, which provides the ordinary least squares linear regression method, and SGDRegressor, which fits a linear model with the stochastic gradient descent algorithm on either the entire training dataset or a portion of it.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Algorithms 2—Linear Regression

  • Yi Sun,
  • Rod Adams

摘要

This chapter starts with defining a simple linear regression method with one variable using Python. Then, it focuses on linear regression with multiple variables. We first show how to obtain the least squares estimation via SymPy. Next, we define a generic function for linear regression with multiple variables. Furthermore, we demonstrate how to call for the linear regression method from scikit-learn in two ways: LinearRegression, which provides the ordinary least squares linear regression method, and SGDRegressor, which fits a linear model with the stochastic gradient descent algorithm on either the entire training dataset or a portion of it.