import numpy as np

class GradientDescent():
    def __init__(self, learning_rate, momentum=0):
        self.learning_rate = learning_rate 
        self.momentum = momentum
        self.w_updt = np.array([])

    def update(self, w, grad_wrt_w):
        if not self.w_updt.any():
            self.w_updt = np.zeros(np.shape(w))
        # Use momentum if set
        self.w_updt = self.momentum * self.w_updt + grad_wrt_w
        # Move against the gradient to minimize loss
        return w - self.learning_rate * self.w_updt
8e0c69b8d8f230bcc9132383c618480d70d1ccb9
<mask token>


class GradientDescent:
    <mask token>
    <mask token>

<mask token>


class GradientDescent:
    <mask token>

    def update(self, w, grad_wrt_w):
        if not self.w_updt.any():
            self.w_updt = np.zeros(np.shape(w))
        self.w_updt = self.momentum * self.w_updt + grad_wrt_w
        return w - self.learning_rate * self.w_updt

<mask token>


class GradientDescent:

    def __init__(self, learning_rate, momentum=0):
        self.learning_rate = learning_rate
        self.momentum = momentum
        self.w_updt = np.array([])

    def update(self, w, grad_wrt_w):
        if not self.w_updt.any():
            self.w_updt = np.zeros(np.shape(w))
        self.w_updt = self.momentum * self.w_updt + grad_wrt_w
        return w - self.learning_rate * self.w_updt

import numpy as np


class GradientDescent:

    def __init__(self, learning_rate, momentum=0):
        self.learning_rate = learning_rate
        self.momentum = momentum
        self.w_updt = np.array([])

    def update(self, w, grad_wrt_w):
        if not self.w_updt.any():
            self.w_updt = np.zeros(np.shape(w))
        self.w_updt = self.momentum * self.w_updt + grad_wrt_w
        return w - self.learning_rate * self.w_updt

import numpy as np

class GradientDescent():
    def __init__(self, learning_rate, momentum=0):
        self.learning_rate = learning_rate 
        self.momentum = momentum
        self.w_updt = np.array([])

    def update(self, w, grad_wrt_w):
        if not self.w_updt.any():
            self.w_updt = np.zeros(np.shape(w))
        # Use momentum if set
        self.w_updt = self.momentum * self.w_updt + grad_wrt_w
        # Move against the gradient to minimize loss
        return w - self.learning_rate * self.w_updt