Feature scaling (normalization processing)

When we face the problem of multi-dimensional features, we need to ensure that these features have similar scales, which will help the gradient descent algorithm to converge faster.

Take the house price problem as an example. Suppose we use two features, the size of the house and the number of rooms. The value of the size is 0-2000 square feet, and the value of the number of rooms is 0-5. The two parameters are the horizontal and vertical coordinates, respectively, and the contour map of the cost function can be drawn. It can be seen that the image will appear very flat, and the gradient descent algorithm needs many iterations to converge.
insert image description here
The solution is to try to scale all the features between -1 and 1 as much as possible. As shown in the picture:
insert image description here

Guess you like

Origin blog.csdn.net/qq_45833373/article/details/131773288