We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
medium
end_to_end
Simple CNN
Build a minimal CNN: 1D convolution + max pooling + fully connected layer.
Pipeline:
- Conv1D: slide a kernel of size K over input with stride 1, add bias. $\text{conv}[i] = \sum_{k=0}^{K-1} x[i+k] \cdot w[k] + b_{conv}$ Output length: $L_{out} = L - K + 1$
- ReLU: element-wise $\max(0, z)$
- Global Max Pool: take the max over the sequence to get a single scalar.
- FC layer: $y = \text{pool\_out} \cdot w_{fc} + b_{fc}$
Input:
-
x: 1D input of shape(L,) -
conv_w: kernel of shape(K,) -
conv_b: scalar bias -
fc_w: FC weight (scalar) -
fc_b: FC bias (scalar)
Output: A scalar prediction.
Hints
cnn
convolution
max-pooling
fully-connected
Sign in to attempt this problem and view the solution.