FAQ
What does Maxpooling actually do
- Invariance — it cares more about whether a feature exists than exactly where it is. Think of it as a strong prior that forces learned features to tolerate some spatial variation.
- Shrinks the input size for the next layer (removes redundancy), cutting down computation and parameter count.
- Produces fixed-length output. (Useful for text classification where input length varies — pooling gives you a consistent output size.)
- Helps prevent overfitting, though it can also cause underfitting if overdone.
Author: Zhihu user
How do you design a good neural network?
Honestly, no idea yet. But for parameter initialization you can just use what
tensorflowgives you, for example:
W1 = tf.Variable(tf.random_normal([784,256])) |
This gets you noticeably better accuracy. Good initial parameters make a real difference.
How many hidden layers should you use?
Trial and error.
What activation functions are there, what do they do, and how do you pick one?
Activation functions introduce non-linearity, so the network can handle non-linearly separable problems.
Visualizing 26 activation functions
What’s the point of activation functions in neural networks — Zhihu
What pooling methods are there?
- maxpooling (slide a window, take the max value of features in the neighborhood)
- meanpooling (take the average)
What do filters do?
At its core, a neural network is basically layers of filters stacked on top of each other — filtering out low-level features, selecting high-level ones.
How do you reduce overfitting in a backpropagation network?
- Early stopping — stop training when training error keeps dropping but validation error starts climbing
- Regularization — add a term to the loss function that penalizes network complexity
What’s the difference between standard BP and accumulated BP?
Same as the difference between standard gradient descent and stochastic gradient descent.
How do you escape local minima?
- Initialize multiple neural networks with different sets of parameters, train them all the standard way, pick the one with lowest error as your final model
- Simulated annealing — at each step accept a worse solution with some probability
- Use stochastic gradient descent
Epoch vs Batch — what’s the difference
One full pass through all the data is an Epoch. That full pass gets split into smaller chunks (batches) for each iteration.
When does a CNN require fixed-size input, and when doesn’t it?
If there’s a fully connected layer, input size must be fixed — because the FC layer connects every input pixel together, and once the parameter count is set it can’t change. So inputs have to be uniform. If you only have convolution and pooling layers, image size doesn’t matter — the filter just scans whatever it gets.
What if images are different sizes but you need fixed size?
- Force resize, but this falls apart if you need fine-grained detection of objects — it distorts things.
- Manual annotation — recommend labelImg
Resources
Is it worth implementing ML algorithms from scratch yourself?
Yes, and try to speed them up too. Get the fundamentals, then experiment.
Deformable convolution, separable convolution? Ten brilliant tricks in CNNs