← Databricks Interview Insights
Start by clearly defining the linear model and MSE loss, then derive the gradients for weights and bias. Implement the training loop with configurable hyperparameters, and finally discuss practical strategies for learning rate selection, stopping criteria, and divergence detection.
Pro tip: Mention that you would standardize features and monitor the loss curve for divergence, and that you can use a simple learning rate schedule like reducing the rate if loss increases.
State the linear model: y_pred = X @ w + b. Define MSE loss: (1/n) * sum((y_pred - y)^2).
Compute gradients: dw = (2/n) * X.T @ (y_pred - y), db = (2/n) * sum(y_pred - y). Explain the derivation briefly.
Initialize weights and bias to zeros. For each iteration: compute predictions, loss, gradients, and update parameters: w -= lr * dw, b -= lr * db. Track loss.
Choose learning rate via grid search or adaptive methods; stop when loss change is below a threshold or after fixed iterations. Detect divergence if loss increases or becomes NaN.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.