gradient descent css code example

Example 1: linear-gradient

background: linear-gradient(to left, #333, #333 50%, #eee 100%);

Example 2: gradient descent algorithm

def update_weights(m, b, X, Y, learning_rate):
    m_deriv = 0
    b_deriv = 0
    N = len(X)
    for i in range(N):
        # Calculate partial derivatives
        # -2x(y - (mx + b))
        m_deriv += -2*X[i] * (Y[i] - (m*X[i] + b))

        # -2(y - (mx + b))
        b_deriv += -2*(Y[i] - (m*X[i] + b))

    # We subtract because the derivatives point in direction of steepest ascent
    m -= (m_deriv / float(N)) * learning_rate
    b -= (b_deriv / float(N)) * learning_rate

    return m, b

Example 3: linear gradient css

/* www.gradientmagic.com will help with producing gradients */

Tags:

Css Example