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.