Answers.Body: <blockquote>
  <p>and then set these partial derivatives to zeros</p>
  </blockquote>
  <p>but how do you do that? This is analytically possible in very simple cases, such as least squares on linear regression. In that case, it's possible to invert the function and explicitly build the weight matrix and the biases.</p>
  <p>But in maths, the vast majority of equations is not analytically solvable, and needs iterative approximation methods that lead you to a numerical solution. This is what gradient descent does.</p>
  <p>To convince yourself of this, I suggest you try: write a simple function representing a neural network with 2 layers, then see if you can do as you say. This will give you a better understanding of why it doesn't work.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-06T08:39:50.420Z
Answers.LastActivityDate: 2022-07-06T08:39:50.420Z
Answers.UserDisplayName: Martino
Body: <p>The purpose of training neural networks is to minimize a loss function, in this process we usually use gradient descent method.</p>
  <p>But in Calculus, if we want to find the global minimum of a multivariable function, we usually first calculate the partial derivatives of this function with respect to its variables, and then set these partial derivatives to zeros, and then find the solutions of these equations. Usually we get a bunch of points. We can use the second derivative method(involving Hesse Matrix) to determine whether these points give local minimum values, or we can directly evaluate the values of the function at these points and compare them to find the minimum.</p>
  <p>So, I'm curious why don't we use this classical method in Calculus to find the global minimum value of the loss function and instead using gradient descent? Is it hard to for computer to find zeros of multivariable equations?</p>
  
Tags: <deep-learning><backpropagation><optimization><gradient-descent>
Title: Why do we use gradient descent to minimize the loss function?
UserDisplayName: Proton
ThreadText: # Why do we use gradient descent to minimize the loss function?
  
  (Asked by: username_0 on 2022-07-05)
  
  The purpose of training neural networks is to minimize a loss function, in this process we usually use gradient descent method.
  
  But in Calculus, if we want to find the global minimum of a multivariable function, we usually first calculate the partial derivatives of this function with respect to its variables, and then set these partial derivatives to zeros, and then find the solutions of these equations. Usually we get a bunch of points. We can use the second derivative method(involving Hesse Matrix) to determine whether these points give local minimum values, or we can directly evaluate the values of the function at these points and compare them to find the minimum.
  
  So, I'm curious why don't we use this classical method in Calculus to find the global minimum value of the loss function and instead using gradient descent? Is it hard to for computer to find zeros of multivariable equations?
  
  **Tags:** deep-learning, backpropagation, optimization, gradient-descent
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-06. Score: 2
  
  > and then set these partial derivatives to zeros
  
  but how do you do that? This is analytically possible in very simple cases, such as least squares on linear regression. In that case, it's possible to invert the function and explicitly build the weight matrix and the biases.
  
  But in maths, the vast majority of equations is not analytically solvable, and needs iterative approximation methods that lead you to a numerical solution. This is what gradient descent does.
  
  To convince yourself of this, I suggest you try: write a simple function representing a neural network with 2 layers, then see if you can do as you say. This will give you a better understanding of why it doesn't work.
  
  
  ---
  
  