Preparing for interview - Logistic regression question
They give you the current values of the model parameters $a$ and $b$, and a new data point $(x,y)$, and they request to perform one training step with gradient descent using the data point, and returning the updated values for $a$ and $b$.
The problem with your code is that the sign of the learning rate is wrong in the parameter update. If you change it to minus, the result is as expected:
new_weights = weights - learnrate * (y - y_hat) * X
new_bias = bias - learnrate*(y - y_hat)