Machine Learning Notes - Linear Regression

Linear regression, mathematically speaking, is a type of machine learning algorithm that uses a differentiable function as a hypothetical model. The main idea is still as outlined. First, find the characteristic variable, and then find this differentiable function according to the existing data. Here you can play various linear functions in mathematics.

Maybe I'm not talking very rigorously here, so logistic regression may also be here. So let me describe the hypothetical model of linear regression:


 
 Here we no longer start with a single variable, and directly come to a tall one. It's multi-eigenvariable here, and if we're familiar (and must be) familiar with matrix vectors, it can be simplified a bit. In this way, the hypothetical function is OK (the actual situation requires specific analysis, the number of features, and the application of the polynomial mentioned later). Note that although there are only n features, the bias unit is added, so the actual feature dimension becomes n+1, and the parameter vector is also n+1-dimensional.

 

Next is the Cost Function (cost function)

Before the picture above, you can imagine for yourself. In fact, all cost functions have a model. If you don't believe me, read it, including gradient descent.

 



 

The cost function here still uses variance. The derivative representation is used in gradient descent, which can also be unified like this. Next, for the specific calculation, we still need to calculate it.

The hypothetical model function can be directly brought into the cost function. To derive the cost function, knowledge of calculus is required here. It's actually very simple.

Compound Function Derivation (uv)' = u'v + uv' 

The final result goes directly to:



 

 

Andrew NG analyzed for us that the situation for a single variable is actually the same as for multivariate. Now, by bringing in the hypothetical function, we can turn it into an implementation.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326524167&siteId=291194637