# What is the function of the hidden layer in a neural network mapping to?

The hidden layers of the neural network which are in between the input layer and the output layer take in input data and apply a function to churn out data from each node which is then weighed by the next layer.

The way I've seen it explained is for example to predict whether a image is a bus , the nodes learn whether there is a wheel , a tire etc or to predict if a person likes a document, the hidden layer nodes map to whether the topic is sports, history etc.

However the "function" that the hidden layer nodes apply, what exactly are they mapping to i.e what is the dependent variable? Is it the output variable that the model is fed ? For example if I'm trying to predict if the image given is that of a dog or cat , then does the hidden layer map the input data to the output variable(dog or cat) ? How exactly does the hidden layer learn useful features? How do the nodes learn different features rather than the same one?

• You might want to check out the small neural network I give here as a function instead of a drawing. (See if you can draw it!)
– Dave
Commented Mar 2, 2023 at 4:08

Dependent variable: Yes, the output variable is dependent value but by being fed what do you mean? (We have a training set and a test set. We feed our model via training set (both independent and dependent values) and then predict the values for the dependent variable in the test set)

There are some features for each sample that are independent like temperature, heart rate, etc. Based upon these independent values, a feature (outcome) is predicted, for instance, whether someone is prone to health issues or not (classification problem). So this output (health issues) that depends on independent features ( temperature, heart rate, etc. is dependent)

Note: each pair of independent variables might be correlated.

If you are trying to predict if an image is a cat or dog, then the outcome might be different based on what activation function we have chosen. for instance, if we have chosen sigmoid activation function, the output would be two probabilities, determining the probability of cat and dog. But if we use the threshold function, it gives 0 or 1.

Actually, the way in which the hidden layers are acting in a neural network varies for different sort of layers like Dense, convolutional, recurrent, etc.

For instance, Dense layers try to figure out what the weights of the features (independent variables) should be, meaning, how important each feature is in determining the output (dependent variable), and then based upon the function we utilize (sigmoid, rectifier, etc) would return probability of each outcome, binary outcome for dependent variables with two outcomes, etc.

What do you mean by "How do the nodes learn different features rather than the same one?"