/ Machine Learning

Basic neural network architecture

When designing a neural network, there are some basic rules, that help you in choosing a layout.

Example classification problem:
fruits = {apple, pear, orange, lemon}
features = {color, shape}

  • Input nodes
    The number of input units should be equal to the number of features in your dataset. => Two inputs based on our example (3 counting the bias unit).

  • Output nodes
    You should have as many output units as distinct classes. => As it could be any of the four fruits, we get four outputs.
    It's worth noting, that the output and the training examples should not output a string "apple", but in a one-hot-encoded format:

  • Hidden nodes
    The more the better, but it's always a tradeoff between accuracy and computing cost.

  • Hidden layers
    Default would be 1 hidden layer. It's suggested to have the same number of hidden nodes on every hidden layer.