One Logistic Regression Gradient Step
~12 mincode completion
Implement logistic_step(X, y, w, b, lr) returning the updated parameters as one array [w1,…,wd,b], bias last.
Where this shows up
~12 min
••••••••••••••
7 employers weight this skill
2 health and bio companies, 2 quant funds, 2 enterprise vendors, 1 AI product company. Top match scores 87.
Python
import numpy as np
def logistic_step(X, y, w, b, lr):
"""
One gradient descent step on the mean log loss.
Args:
X: array of shape (n, d)
y: array of shape (n,), labels 0 or 1
w: array of shape (d,), current weights
b: float, current bias
lr: learning rate
Returns:
array of shape (d + 1,): [w_1, ..., w_d, b] after the step
"""
# YOUR CODE HERE
pass