Answers.Body: <p>Activations can help with brightness, but not in the way you described, not by smoothing.</p>
  <p>Without activation, all your layers collapse to a single linear operation, just because in matrix operations W1*W2 = W3. That means the prediction from every pixel is independent. Like, you can learn that the pixel at position (5,6) is brighter for #7 and darker for #1. That's it; it's the only level of complexity you have.</p>
  <p>With activations, you can build a deeper network with more complex relationships. It can train that neuron 17 on layer 2 could have average brightness and then it can be subtracted from all other pixels.</p>
  <p>As for size change, activations don't help with it. In fact, even convolutional layers are not scale-invariant, let alone multiple linear layers. For that, you would need something like a U-Net or multi-scale networks.</p>
  <p>Bottom line, people learned that non-linearity is extremely important, but the exact shape of it is not so much.</p>
  <p>Google has a nice playground for MLP <a href="https://playground.tensorflow.org/" rel="nofollow noreferrer">https://playground.tensorflow.org/</a>
  And an extended explanation, including MNIST <a href="https://cloud.google.com/blog/products/ai-machine-learning/understanding-neural-networks-with-tensorflow-playground" rel="nofollow noreferrer">https://cloud.google.com/blog/products/ai-machine-learning/understanding-neural-networks-with-tensorflow-playground</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-15T14:46:46.690Z
Answers.Text: Thanks of the response. I understand that the activation function does not help with the shape. If the two 7's are the same in every way except brightness/darkness when those pre activation values are entered into a sigmoid they will come out to be around the same 0.993 vs 0.991 so then they will be treated the same throughout the rest of the network. Does that make sense ?
Answers.UserDisplayName: Stef
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-19T11:55:32.760Z
Answers.Text: The case you describing is when nn is very confident anyway. Now imagine it gave probability not 99.3%, but let's say 90%. With half the brightness it will recalculates as sigmoid(logit(p/2)) = 73%, which is almost triple error.
Answers.UserDisplayName: Kirill Fedyanin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-15T07:40:16.143Z
Answers.LastActivityDate: 2024-02-15T07:46:40.397Z
Answers.LastEditDate: 2024-02-15T07:46:40.397Z
Answers.UserDisplayName: Kirill Fedyanin
Body: <p>I just want to verify the my intuition of why activation functions are necessary. For this example lets consider a network that classifies numbers 0-9. A network WITHOUT an activation function will be able to do well on numbers that are similar to the sizes of the numbers in the training set but it will struggle if numbers appear to be darker or lighter because it is linear and cannot take both size and lightness/darkness into account. In a neural network completeing the same task but WITH activation functions will be able to take into account both orientation and lightness/darkness because the weights will learn all possible relationships between the pixel values in the data set and the sigmoid(or other acctivation function) will then take number that are slighty lighter or darker and transform/smooth them so that the network could ouput the same probability as if it were the nomral darkness/lightness. Does this intuition sound about right or is it incorrect in some way ?</p>
  <p>Here is another example of what I am trying to descirbe if this makes more sense: I understand it is a non linearity but mabey let me try and explain what I am thinking in a diffrent way. In a network that is detecting numbers 0-9 the network has learned for example all the relationships between the pixels of a 7 of standard darkness in all sorts of positions. Then during test time a lighter 7 comes along with slighlty lighter pixel values. In one of the neurons in the input layer after the lighter 7’s input has been multiplied by the weights and biases for that neuron when it is transformed by the sigmoid function it will have aproximatly the same value the darker one after passing through sigmoid in neuron one would be 0.994 and the lighter one 0.992 so then the lighter one will get treated the same through all later layer of the network and get classified correclty. Does that make sense ?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-16T04:54:31.960Z
Comments.Text: Why do you claim "it will have aproximatly the same value the darker one after passing through sigmoid in neuron one would be 0.994 and the lighter one 0.992"? Imagine you simply have Relu activation function, it's obviously not the case but the output of the whole network can still work well.
Comments.UserDisplayName: cinch
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-16T10:46:07.937Z
Comments.Text: Can you please put your **specific question** in the title? "Activation function intuition question" is just the announcement of the question, but we already know that you have a question.
Comments.UserDisplayName: nbro
Tags: <neural-networks><activation-functions>
Title: Activation function intuition question
UserDisplayName: Stef
ThreadText: # Activation function intuition question
  
  (Asked by: username_0 on 2024-02-15)
  
  I just want to verify the my intuition of why activation functions are necessary. For this example lets consider a network that classifies numbers 0-9. A network WITHOUT an activation function will be able to do well on numbers that are similar to the sizes of the numbers in the training set but it will struggle if numbers appear to be darker or lighter because it is linear and cannot take both size and lightness/darkness into account. In a neural network completeing the same task but WITH activation functions will be able to take into account both orientation and lightness/darkness because the weights will learn all possible relationships between the pixel values in the data set and the sigmoid(or other acctivation function) will then take number that are slighty lighter or darker and transform/smooth them so that the network could ouput the same probability as if it were the nomral darkness/lightness. Does this intuition sound about right or is it incorrect in some way ?
  
  Here is another example of what I am trying to descirbe if this makes more sense: I understand it is a non linearity but mabey let me try and explain what I am thinking in a diffrent way. In a network that is detecting numbers 0-9 the network has learned for example all the relationships between the pixels of a 7 of standard darkness in all sorts of positions. Then during test time a lighter 7 comes along with slighlty lighter pixel values. In one of the neurons in the input layer after the lighter 7’s input has been multiplied by the weights and biases for that neuron when it is transformed by the sigmoid function it will have aproximatly the same value the darker one after passing through sigmoid in neuron one would be 0.994 and the lighter one 0.992 so then the lighter one will get treated the same through all later layer of the network and get classified correclty. Does that make sense ?
  
  **Tags:** neural-networks, activation-functions
  
  > **Comments:**
  > **username_1**: Why do you claim "it will have aproximatly the same value the darker one after passing through sigmoid in neuron one would be 0.994 and the lighter one 0.992"? Imagine you simply have Relu activation function, it's obviously not the case but the output of the whole network can still work well.  
  > **username_2**: Can you please put your **specific question** in the title? "Activation function intuition question" is just the announcement of the question, but we already know that you have a question.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2024-02-15. Score: 3 | Accepted answer
  
  Activations can help with brightness, but not in the way you described, not by smoothing.
  
  Without activation, all your layers collapse to a single linear operation, just because in matrix operations W1\*W2 = W3. That means the prediction from every pixel is independent. Like, you can learn that the pixel at position (5,6) is brighter for #7 and darker for #1. That's it; it's the only level of complexity you have.
  
  With activations, you can build a deeper network with more complex relationships. It can train that neuron 17 on layer 2 could have average brightness and then it can be subtracted from all other pixels.
  
  As for size change, activations don't help with it. In fact, even convolutional layers are not scale-invariant, let alone multiple linear layers. For that, you would need something like a U-Net or multi-scale networks.
  
  Bottom line, people learned that non-linearity is extremely important, but the exact shape of it is not so much.
  
  Google has a nice playground for MLP <https://playground.tensorflow.org/>
  And an extended explanation, including MNIST <https://cloud.google.com/blog/products/ai-machine-learning/understanding-neural-networks-with-tensorflow-playground>
  
  > **Comments:**
  > **username_0**: Thanks of the response. I understand that the activation function does not help with the shape. If the two 7's are the same in every way except brightness/darkness when those pre activation values are entered into a sigmoid they will come out to be around the same 0.993 vs 0.991 so then they will be treated the same throughout the rest of the network. Does that make sense ?  
  > **username_3**: The case you describing is when nn is very confident anyway. Now imagine it gave probability not 99.3%, but let's say 90%. With half the brightness it will recalculates as sigmoid(logit(p/2)) = 73%, which is almost triple error.  
  
  ---
  
  