We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Regression from Scratch step 1 of 4
Easy
End-to-End
Linear Regression
Implement a simple linear regression model with MSE loss.
The model predicts: $\hat{y} = x \cdot w + b$
The MSE loss is: $L = \frac{1}{N} \sum (y - \hat{y})^2$
Input:
-
x: input tensor of shape(N, 1) -
w: weight scalar of shape(1, 1) -
b: bias scalar of shape(1,) -
y: target values of shape(N, 1)
Output: A dict with “prediction” (shape (N, 1)) and “loss” (scalar).
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.