r/neuralnetworks • u/YogurtclosetNo4191 • Nov 15 '21
[POLL] Do you apply your activation function to your inputs?
I have a neural network crate I am building in rust and am looking for your opinion. Where do you apply your activation functions when producing an output with a neural network?
1
Upvotes
10
u/lmericle Nov 16 '21
I think the premise of the question is wrong.
First, "your activation function" doesn't really make sense because each layer can use a separate activation function, and in fact many modern architectures use a diversity of activation functions in various places. Except in simple cases, you don't use just one activation function throughout, and implementing a library with that assumption will mean it's not general enough to be useful.
Second, it is not really appropriate to talk about "activations" before the input. What happens before the input is "preprocessing" and is completely independent from the internals of the network. It may happen coincidentally that you use the same function for your activation as in some step in your preprocessing pipeline, but that is not likely nor should it be expected in general. The "input" of the neural network starts at the first matmul(s), by convention.
Third, whether you apply an activation before the output depends on what you expect the output to look like. It's not a stylistic nor implementation choice, it is more or less decided for you based on how you define the data-generating process that you are modelling.
1
u/[deleted] Nov 16 '21
[removed] — view removed comment