Questions tagged [gradient-descent]

Gradient Descent is an algorithm for finding the minimum of a function. It iteratively calculates partial derivatives (gradients) of the function and descends in steps proportional to those partial derivatives. One major application of Gradient Descent is fitting a parameterized model to a set of data: the function to be minimized is an error function for the model.

Wiki:

Gradient descent is a first-order iterative optimization algorithm. It is an optimization algorithm used to find the values of parameters (coefficients) of a function (f) that minimizes a cost function (cost).

To find a local minimum of a function using gradient descent, one takes steps proportional to the negative of the gradient (or of the approximate gradient) of the function at the current point.

Gradient descent is best used when the parameters cannot be calculated analytically (e.g. using linear algebra) and must be searched for by an optimization algorithm.

Gradient descent is also known as steepest descent, or the method of steepest descent.


Tag usage:

Questions on should be about implementation and programming problems, not about the theoretical properties of the optimization algorithm. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.


Read more:

1428 questions
0
votes
0 answers

Increasing and wide spreading cost function with Stochastic Gradient Descent

I am using Tensorflow in an online learning environment. As cost function is implemented: cost = tf.sqrt(tf.reduce_mean(tf.square(tf.sub(Y, output)))) Optimization is done like: train_op = tf.train .GradientDescentOptimizer(0.0001) …
hallo02
  • 307
  • 3
  • 11
0
votes
2 answers

Implementing naive gradient descent in python

I'm trying to implement a very naive gradient descent in python. However, it looks like it goes into an infinite loop. Could you please help me debug it? y = lambda x : x**2 dy_dx = lambda x : 2*x def…
0
votes
1 answer

Gradient Descent diverges, learning rate too high

There is a piece of code below, which does GD step by step but theta is diverging. What could be wrong? X = arange(100) Y = 50 + 4*X + uniform(-20, 20, X.shape) theta = array([0,0]) alpha = 0.001 # one step of GD theta0 = theta[0] - alpha * sum(…
ArekBulski
  • 4,520
  • 4
  • 39
  • 61
0
votes
0 answers

Tensorflow synchronous gradient GD getting hung after one epoch on master

I have the following code (below) to perform tensorflow synchronous gradient descent based on their example here: https://github.com/tensorflow/models/blob/master/inception/inception/inception_distributed_train.py Run With The command I'm using for…
Raul Puri
  • 119
  • 1
  • 1
  • 12
0
votes
0 answers

Efficiency of Gradient Ascent vs Hill Climbing

I'm running both gradient ascent and hill climbing on a landscape to assess which one can reach the greatest height in less steps. The outcome of my test is that hill climbing always manages to reach greater heights in less increments in comparison…
PRCube
  • 566
  • 2
  • 6
  • 19
0
votes
0 answers

Gradient Descent in Python 2

Part of my assignment is to implement the Gradient Descent to find the best approximation of values c_1, c_2 and r_1 for the function . Given is only a list of 30 y-values corresponding to x from 0 to 30. I am implementing this in Enthought Canopy…
Marcel
  • 335
  • 1
  • 2
  • 10
0
votes
1 answer

What machine learning algorithm to train to use feature weights as output for a decision tree?

I have a purely categorical data set, with a very imbalanced class weight (1:99). I would like to train a model which will compute for each of the features and values of said feature, what importance it has on the prediction. So in essence to…
dendog
  • 2,976
  • 5
  • 26
  • 63
0
votes
0 answers

performing stochastic gradient descent on a neural network

I want to perform SGD on the following neural network: Training set size = 200000 input layer size = 784 hidden layer size = 50 output layer size = 10 I have an algorithm that performs batch gradient descent.I guess to perform SGD , the cost…
0
votes
1 answer

Gradient Descent Variation doesn't work

I try to implement the Stochastic Gradient Descent Algorithm. The first solution works: def gradientDescent(x,y,theta,alpha): xTrans = x.transpose() for i in range(0,99): hypothesis = np.dot(x,theta) loss = hypothesis - y …
Cyberlander
  • 145
  • 1
  • 1
  • 11
0
votes
0 answers

Gradient Descent algorithm not converging

I am trying to implement an algorithm for a Social Recommender System. The algorithm predicts the rating given to an item by a user, using the global reputation of the user and a similarity matrix. I am using matrix factorization to find the values…
0
votes
1 answer

XGBoost (Gradient Boosting) vs Random Forest

(Hope this is a right forum for this type of question, if not please kindly suggest.) What is the performance of gradient boosting in XGBoost library versus Random Forest? Are there any benchmark numbers comparing the two? I am about to start some…
nikk
  • 2,627
  • 5
  • 30
  • 51
0
votes
2 answers

Smoothing a determined path using gradient descent and buffers? [MATLAB]

I'm writing an algorithm to plan a path for an autonomous rover using MATLAB, and am having a lot of issue smoothing the path. Right now I generate a series of waypoints (134 points) so that my robot does not hit any obstacles and takes the shortest…
user5363872
0
votes
0 answers

Gradient Descent on Hinge Loss SVM Python implmentation

I am trying to implement gradient descent algorithm to minimize the objective of hinge loss of SVM. The equation I am trying to implement is and max function is handled by sub gradient technique as below. The issue is I am not able to get proper…
Incpetor
  • 1,293
  • 6
  • 25
  • 46
0
votes
1 answer

Stochastic gradient descent algorithm in MATLAB

I'm trying to implement stochastic gradient descent in MATLAB, but I'm going wrong somewhere. I think that maybe the way I am checking for convergence is incorrect (I wasn't quite sure how to update the estimator with each iteration), but I'm not…
0
votes
1 answer

Code Not Converging Vanilla Gradient Descent

I have a specific analytical gradient I am using to calculate my cost f(x,y), and gradients dx and dy. It runs, but I can't tell if my gradient descent is broken. Should I plot my partial derivatives x and y? import math gamma = 0.00001 # learning…
bambo222
  • 419
  • 7
  • 15