Simple and crude understanding and implementation of machine learning linear regression (a): Linear regression analysis of the relationship between profiles, application scenarios, features and objectives

Linear Regression

learning target

  • Ownership in the implementation process of linear regression
  • Application LinearRegression or SGDRegressor achieve regression prediction
  • We know the assessment criteria and formulas regression algorithm
  • Overfitting know the causes and solutions underfitting
  • We know principle ridge regression and linear regression differences
  • Application Ridge achieve regression prediction
  • Application joblib achieve saving and loading models

2.1 Introduction to Linear Regression

Here Insert Picture Description

1 linear regression scenarios

  • Prices forecast

  • Sales Prediction

  • Loan amount forecast

    For example:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-hgqQm53v-1583243847789) (../ images /% E7% BA% BF% E6% 80% A7% E5 % 9B% 9E% E5% BD% 92% E4% B8% BE% E4% BE% 8B.png)]

2 What is the linear regression

2.1 Definitions and formula

Linear Regression (Linear regression) using the regression equation (function) for between the independent variables (characteristic value) and the dependent variable (target value) of one or more relationships for modeling an analytical way.

  • Features: with only one independent variable is called a single-variable regression, more than one independent variable is called multiple regression case

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-u7O9b2gb-1583243847789) (../ images /% E7% BA% BF% E6% 80% A7% E5 % 9B% 9E% E5% BD% 92% E5% 85% AC% E5% BC% 8F.png)]

  • Examples denoted by linear regression matrix

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-N1dc2nBs-1583243847790) (../ images /% E7% BA% BF% E6% 80% A7% E5 % 9B% 9E% E5% BD% 92% E7% 9F% A9% E9% 98% B5% E8% A1% A8% E7% A4% BA% E6% B3% 95.png)]

So how to understand it? Let's look at a few examples

  • Final grade: 0.7 × test scores + 0.3 × normal results
  • House prices from the central area = 0.02 × + 0.04 × city nitric oxide concentration + (-0.12 × average rate from the housing) + 0.254 × urban crime

Two examples above, we see the establishment of a relationship between the characteristic value and the target value, this relationship can be understood as a linear model .

Analysis of the relationship with the target of 2.2 Characteristics linear regression

There are two main linear regression model which, ** one is a linear relationship, the other is a non-linear relationship. ** Here we can only draw a plane to be better understood, the features are for example a single or two sub-features.

  • Linear relationship

    • Univariate linear relationship:

    [Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-pjExGowv-1583243847790) (../ images /% E7% BA% BF% E6% 80% A7% E5 % 85% B3% E7% B3% BB% E5% 9B% BE.png)]

    • Multivariate linear relationship

      [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AHr1dyhP-1583243847791)(../images/%E5%A4%9A%E5%8F%98%E9%87%8F%E7%BA%BF%E6%80%A7%E5%85%B3%E7%B3%BB.png)]

NOTE: Relation between the target characteristics and a linear relationship, or wherein the target value exhibits two planar relationship

The higher dimensions we do not have to think, you can remember this relationship

  • Non-linear relationship

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7ZvBZifj-1583243847791)(../images/%E9%9D%9E%E7%BA%BF%E6%80%A7%E5%85%B3%E7%B3%BB.png)]

Comment: Why is this relationship? what is the reason?

If the non-linear relationship, the regression equation can be understood as: w 1 x 1 + w 2 x 2 2 + w3x3 2

Published 596 original articles · won praise 790 · Views 100,000 +

Guess you like

Origin blog.csdn.net/qq_35456045/article/details/104642776