75 votes

What is the difference between Gradient Descent and Stochastic Gradient Descent?

For a quick simple explanation: In both gradient descent (GD) and stochastic gradient descent (SGD), you update a set of parameters in an iterative manner to minimize an error function. While in GD, ...
user avatar
  • 1,063
44 votes
Accepted

Does gradient descent always converge to an optimum?

Gradient Descent is an algorithm which is designed to find the optimal points, but these optimal points are not necessarily global. And yes if it happens that it diverges from a local location it may ...
user avatar
  • 13.3k
28 votes
Accepted

Is Gradient Descent central to every optimizer?

No. Gradient descent is used in optimization algorithms that use the gradient as the basis of its step movement. Adam, Adagrad, ...
user avatar
  • 396
27 votes
Accepted

Why ReLU is better than the other activation functions

The biggest advantage of ReLu is indeed non-saturation of its gradient, which greatly accelerates the convergence of stochastic gradient descent compared to the sigmoid / tanh functions (paper by ...
user avatar
  • 830
23 votes
Accepted

Scikit-learn: Getting SGDClassifier to predict as well as a Logistic Regression

The comments about iteration number are spot on. The default SGDClassifier n_iter is 5 ...
user avatar
  • 951
18 votes

Does gradient descent always converge to an optimum?

Asides from the points you mentioned (convergence to non-global minimums, and large step sizes possibly leading to non-convergent algorithms), "inflection ranges" might be a problem too. Consider the ...
user avatar
  • 1,147
15 votes

What is the difference between Gradient Descent and Stochastic Gradient Descent?

The inclusion of the word stochastic simply means the random samples from the training data are chosen in each run to update parameter during optimisation, within the framework of gradient descent. ...
user avatar
  • 13.8k
15 votes
Accepted

How does Gradient Descent and Backpropagation work together?

First, remember that the derivative of a function gives the direction in which the function increases, and its negative, the direction in which the function decreases. Training a model is just ...
user avatar
14 votes

What is the difference between SGD classifier and the Logisitc regression?

Welcome to SE:Data Science. SGD is a optimization method, while Logistic Regression (LR) is a machine learning algorithm/model. You can think of that a machine learning model defines a loss function, ...
user avatar
  • 2,119
13 votes
Accepted

Why isn't leaky ReLU always preferable to ReLU given the zero gradient for x<0?

One reason that ReL Units have been introduced is to circumvent the problem of vanishing gradients of sigmoidal units at -1 and 1. Another advantage of ReL Units is that they saturate at exactly 0 ...
user avatar
  • 5,960
11 votes
Accepted

Can overfitting occur in Advanced Optimization algorithms?

There is no technique that will eliminate the risk of overfitting entirely. The methods you've listed are all just different ways of fitting a linear model. A linear model will have a global minimum, ...
user avatar
  • 4,039
11 votes
Accepted

Using a random forest, would a RandomForest performance be less if I drop the first or the last tree?

The two slightly-smaller models will perform exactly the same, on average. There is no difference baked in to the different trees: "the last tree will be the best trained" is not true. The ...
user avatar
  • 9,249
11 votes
Accepted

What is momentum in neural network?

Momentum in neural networks is a variant of the stochastic gradient descent. It replaces the gradient with a momentum which is an aggregate of gradients as very well explained here. It is also the ...
user avatar
  • 1,125
10 votes
Accepted

Stochastic gradient descent based on vector operations?

First of all, word "sample" is normally used to describe subset of population, so I will refer to the same thing as "example". Your SGD implementation is slow because of this line: ...
user avatar
  • 2,771
10 votes
Accepted

Trying to understand Logistic Regression Implementation

There are several issues I see with the implementation. Some are just unnecessarily complicated ways of doing it, but some are genuine errors. Primary takeaways A: Try to start from the math behind ...
user avatar
  • 516
10 votes
Accepted

What feature engineering is necessary with tree based algorithms?

Feature engineering that I would consider essential for even tree based algorithms are: Modular arithmetic calculations: e.g. converting a timestamp into day of the week, or time of day. If your ...
user avatar
10 votes
Accepted

Why averaging the gradient works in Gradient Descent?

Each training sample ends up in a distant, completely separate location on the error-surface That is not a correct visualisation of what is going on. The error surface plot is tied to the value of ...
user avatar
  • 27.2k
9 votes
Accepted

Why is learning rate causing my neural network's weights to skyrocket?

You might find Chapter 8 of Deep Learning helpful. In it, the authors discuss training of neural network models. It's very intricate, so I'm not surprised you're having difficulties. One possibility (...
user avatar
  • 331
9 votes

Why do we use gradients instead of residuals in Gradient Boosting?

Hmmm, I am little perplexed by your question. In gradient boosting, we do use the residuals. The residuals are the gradients. You can check my simple implementation of gradient boosting. This is ...
user avatar
9 votes

What is the difference between Gradient Descent and Stochastic Gradient Descent?

In Gradient Descent or Batch Gradient Descent, we use the whole training data per epoch whereas, in Stochastic Gradient Descent, we use only single training example per epoch and Mini-batch Gradient ...
user avatar
8 votes

Is Gradient Descent central to every optimizer?

According to the title: No. Only specific types of optimizers are based on Gradient Descent. A straightforward counterexample is when optimization is over a discrete space where gradient is undefined. ...
user avatar
  • 8,469
7 votes
Accepted

How to update weights in a neural network using gradient descent with mini-batches?

Let us say that the output of one neural network given it's parameters is $$f(x;w)$$ Let us define the loss function as the squared L2 loss (in this case). $$L(X,y;w) = \frac{1}{2n}\sum_{i=0}^{n}[f(...
user avatar
7 votes
Accepted

Why is stochastic gradient descent so much worse than batch GD for MNIST task?

Why is stochastic gradient descent so much worse then batch GD for MNIST task? It isn't inherently worse. Instead, by changing just one parameter on its own you have adjusted the example outside of ...
user avatar
  • 27.2k
7 votes
Accepted

How does LightGBM deal with value scale?

Generally, in tree-based models the scale of the features does not matter. This is because at each tree level, the score of a possible split will be equal whether the respective feature has been ...
user avatar
  • 270
7 votes

Gradient descent and partial derivatives

What's the point? First, it is good to understand what we are doing that leads us to need these tools. When we are trying to apply machine learning we want to infer some meaning from data. This means ...
user avatar
  • 8,478
7 votes
Accepted

Duplicated features for gradient descent

In 'Efficient Backprop' by Lecun and others (http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf), they explain why correlated variables are bad (§ 4.3 normalizing the inputs). Duplicated data is a ...
user avatar
  • 2,107
7 votes
Accepted

How many times is backprop used in epoch?

It depends on the type of gradient descent or respectively your batch size: One epoch means that your neural net (NN) has applied the forward pass on all examples of your training data, i.e. it has "...
user avatar
  • 4,807
7 votes

Difference between RMSProp and Momentum?

Optimizers evolved with small Fix/Improvement on the previous one. So, if you will read in sequence, you will have a better understanding. In this context, RMSProp was a fix on Adagrad and it was an ...
user avatar
  • 5,114
6 votes
Accepted

Understanding dropout and gradient descent

In dropout as described in here, weights are not masked. Instead, the neuron activations are masked, per example as it is presented for training (i.e. the mask is randomised for each run forward and ...
user avatar
  • 27.2k
6 votes

Does gradient descent always converge to an optimum?

Conjugate gradient is not guaranteed to reach a global optimum or a local optimum! There are points where the gradient is very small, that are not optima (inflection points, saddle points). Gradient ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible