UNQ_C6
def compute_gradient_reg(X, y, w, b, lambda_ = 1):
“”"
Computes the gradient for logistic regression with regularization
Args:
X : (ndarray Shape (m,n)) data, m examples by n features
y : (ndarray Shape (m,)) target value
w : (ndarray Shape (n,)) values of parameters of the model
b : (scalar) value of bias parameter of the model
lambda_ : (scalar,float) regularization constant
Returns
dj_db : (scalar) The gradient of the cost w.r.t. the parameter b.
dj_dw : (ndarray Shape (n,)) The gradient of the cost w.r.t. the parameters w.
"""
m, n = X.shape
dj_db, dj_dw = compute_gradient(X, y, w, b)
Moderator edit. Code removed.
### END CODE HERE ###
return dj_db, dj_dw
This is the assignment for week 3. Got incorrect results. Does anyone know how to fix it?