Skip to main content
Mod Moved Comments To Chat
I removed the pseudo-code, as I think it's not really necessary and only clutters the post.
Source Link
nbro
  • 41.4k
  • 12
  • 114
  • 205

Is this idea to calculate the required number of hidden neurons for a single hidden layer neural network correct?

I have an idea to find the optimal number of hidden neurons required in a neural network, but I'm not sure how accurate it is.

Assuming that it has only 1 hidden layer, it is a classification problem with 1 output node (so it's a binary classification task), has N input nodes for N features in the data set, and every node is connected to every node in the next layer.

I'm thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data, like in a complete graph. So, if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So, if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With 6 input nodes, 2 hidden nodes, and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. Therefore, the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

 def complete_graph_edges(features):
    if features > 2: return complete_graph_edges(features-1) + features - 1
    else: return 1

# maximum is the maximum edges required to ensure all paths are covered, features is the amount of input features
def hidden_neuron_count(maximum, features):
    count = 1
    connections = features
    while(connections < maximum):
        count += 1
        connections = (count * features) + (count)
    return count

features = 6
print(hidden_neuron_count(complete_graph_edges(features), features)) # 3

This answer discusses another method. For the sake of argument, I've tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, $\alpha = 2$, and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this to 600 would result in a maximum of 42 hidden neurons.

Based on my idea  ,I I think there should be at most 3 hidden nodes and I can't imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42, like in the second example?

Is this idea to calculate the required number of neurons for a single hidden layer neural network correct?

I have an idea to find the optimal number of hidden neurons required in a neural network, but I'm not sure how accurate it is.

Assuming that it has only 1 hidden layer, it is a classification problem with 1 output node (so it's a binary classification task), has N input nodes for N features in the data set, and every node is connected to every node in the next layer.

I'm thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data, like in a complete graph. So, if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So, if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With 6 input nodes, 2 hidden nodes, and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. Therefore, the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

 def complete_graph_edges(features):
    if features > 2: return complete_graph_edges(features-1) + features - 1
    else: return 1

# maximum is the maximum edges required to ensure all paths are covered, features is the amount of input features
def hidden_neuron_count(maximum, features):
    count = 1
    connections = features
    while(connections < maximum):
        count += 1
        connections = (count * features) + (count)
    return count

features = 6
print(hidden_neuron_count(complete_graph_edges(features), features)) # 3

This answer discusses another method. For the sake of argument, I've tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, $\alpha = 2$, and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this to 600 would result in a maximum of 42 hidden neurons.

Based on my idea  ,I think there should be at most 3 hidden nodes and I can't imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42, like in the second example?

Is this idea to calculate the required number of hidden neurons for a single hidden layer neural network correct?

I have an idea to find the optimal number of hidden neurons required in a neural network, but I'm not sure how accurate it is.

Assuming that it has only 1 hidden layer, it is a classification problem with 1 output node (so it's a binary classification task), has N input nodes for N features in the data set, and every node is connected to every node in the next layer.

I'm thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data, like in a complete graph. So, if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So, if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With 6 input nodes, 2 hidden nodes, and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. Therefore, the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

This answer discusses another method. For the sake of argument, I've tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, $\alpha = 2$, and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this to 600 would result in a maximum of 42 hidden neurons.

Based on my idea, I think there should be at most 3 hidden nodes and I can't imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42, like in the second example?

deleted 37 characters in body; edited tags
Source Link
nbro
  • 41.4k
  • 12
  • 114
  • 205

Maximum nodes in Is this idea to calculate the required number of neurons for a single hidden layer neural network correct?

I have an idea to find the optimal number of hidden neurons required in a neural network, but I'm not sure how accurate it is.

Assuming that it has only one1 hidden layer, it is a classification problem with one1 output node (so it's a binary classification task), has N input nodes for N features in the data set, and every node is connected to every node in the next layer.

I’mI'm thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data, like in a complete graph. So, if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So, if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With With 6 input nodes, 2 hidden nodes, and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. thereforeTherefore, the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

 def complete_graph_edges(features):
    if features > 2: return complete_graph_edges(features-1) + features - 1
    else: return 1

# maximum is the maximum edges required to ensure all paths are covered, features is the amount of input features
def hidden_neuron_count(maximum, features):
    count = 1
    connections = features
    while(connections < maximum):
        count += 1
        connections = (count * features) + (count)
    return count

features = 6
print(hidden_neuron_count(complete_graph_edges(features), features)) # 3

https://stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw

The second answer from hereThis answer discusses another method. For the sake of argument I’ve, I've tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, alpha of 2$\alpha = 2$, and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this tooto 600 would result in a maximum of 42 hidden neurons.

Based on my idea I,I think there should be at most 3 hidden nodes and I can’tcan't imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42, like in the second example?

Maximum nodes in hidden layer

I have an idea to find the optimal number of hidden neurons required in a neural network but I'm not sure how accurate it is.

Assuming that it has only one hidden layer, it is a classification problem with one output node, has N input nodes for N features in the data set and every node is connected to every node in the next layer.

I’m thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data like in a complete graph. So if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With 6 input nodes, 2 hidden nodes and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. therefore the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

 def complete_graph_edges(features):
    if features > 2: return complete_graph_edges(features-1) + features - 1
    else: return 1

# maximum is the maximum edges required to ensure all paths are covered, features is the amount of input features
def hidden_neuron_count(maximum, features):
    count = 1
    connections = features
    while(connections < maximum):
        count += 1
        connections = (count * features) + (count)
    return count

features = 6
print(hidden_neuron_count(complete_graph_edges(features), features)) # 3

https://stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw

The second answer from here discusses another method. For the sake of argument I’ve tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, alpha of 2 and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this too 600 would result in a maximum of 42 hidden neurons.

Based on my idea I think there should be at most 3 hidden nodes and I can’t imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42 like in the second example?

Is this idea to calculate the required number of neurons for a single hidden layer neural network correct?

I have an idea to find the optimal number of hidden neurons required in a neural network, but I'm not sure how accurate it is.

Assuming that it has only 1 hidden layer, it is a classification problem with 1 output node (so it's a binary classification task), has N input nodes for N features in the data set, and every node is connected to every node in the next layer.

I'm thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data, like in a complete graph. So, if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So, if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With 6 input nodes, 2 hidden nodes, and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. Therefore, the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

 def complete_graph_edges(features):
    if features > 2: return complete_graph_edges(features-1) + features - 1
    else: return 1

# maximum is the maximum edges required to ensure all paths are covered, features is the amount of input features
def hidden_neuron_count(maximum, features):
    count = 1
    connections = features
    while(connections < maximum):
        count += 1
        connections = (count * features) + (count)
    return count

features = 6
print(hidden_neuron_count(complete_graph_edges(features), features)) # 3

This answer discusses another method. For the sake of argument, I've tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, $\alpha = 2$, and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this to 600 would result in a maximum of 42 hidden neurons.

Based on my idea ,I think there should be at most 3 hidden nodes and I can't imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42, like in the second example?

Became Hot Network Question
Source Link
w13rfed
  • 205
  • 1
  • 5

Maximum nodes in hidden layer

I have an idea to find the optimal number of hidden neurons required in a neural network but I'm not sure how accurate it is.

Assuming that it has only one hidden layer, it is a classification problem with one output node, has N input nodes for N features in the data set and every node is connected to every node in the next layer.

I’m thinking that to ensure that the network is able to extract all of the useful relations between the data, then every piece of data must be linked to every other piece of data like in a complete graph. So if you have 6 inputs, there must therefore be 15 edges to make it complete. Any more and it will be recomputing previously computed information and any less will be not computing every possible relation.

So if a network has 6 input nodes, 1 hidden node, 1 output node. There will be 6 + 1 connections. With 6 input nodes, 2 hidden nodes and 1 output node, there will be 12 + 2 connections. With 3 hidden nodes there will be 21 connections. therefore the hidden layer should have 3 hidden nodes to ensure all possibilities are covered.

 def complete_graph_edges(features):
    if features > 2: return complete_graph_edges(features-1) + features - 1
    else: return 1

# maximum is the maximum edges required to ensure all paths are covered, features is the amount of input features
def hidden_neuron_count(maximum, features):
    count = 1
    connections = features
    while(connections < maximum):
        count += 1
        connections = (count * features) + (count)
    return count

features = 6
print(hidden_neuron_count(complete_graph_edges(features), features)) # 3

https://stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw

The second answer from here discusses another method. For the sake of argument I’ve tried to keep both examples using the same data. If this idea is computed with 6 input features, 1 output node, alpha of 2 and 60 samples in the training set, this would result in a maximum of 4 hidden neurons. As 60 samples is very small, increasing this too 600 would result in a maximum of 42 hidden neurons.

Based on my idea I think there should be at most 3 hidden nodes and I can’t imagine anymore being useful, but would there be any reason to go beyond 3 and up to 42 like in the second example?