As in ML Specialisation -> Course 2 -> Week 2 Lab Assignment, I’ve created a neural network to read handwritten digits from images. It has 3 layers, L1 = 25 units L2 = 15 units. L3 = 10 units each representing a category (digit in this case)
How do I know which unit in the final layer represents probability for which handwritten digit? For example, how do I know that unit 1 doesn’t correspond to probability for digit 7.
As per ChatGPT:
“To know which unit represents which digit, you can refer to the order of classes when the neural network was trained. Often, the order is assigned based on numerical order, as in the example above. However, it’s crucial to verify this order and ensure it matches the expected class labels in your specific application. If the order is not as expected, you may need to adjust it accordingly.”
Is there a more definitive rule or way of determining this category to unit mapping?
It’s by how you label them. If you label digit seven as 1, then the unit 1 represents digit seven. The algorithm only looks at the labels (which has to be started from 0), and you are responsible for how to assign labels to digits.
Why is a_1 the probability of y = 1 (the label 1) in the first place? Is there something about the formula that makes it so? Digging into it more, it seems this is more a design convention, but please correct me if I’m wrong. And I think it’s also by how we do back propagation and train the model, because we need to calculate the loss and to calculate loss, we need to have some “yardstick” each unit measures its outputs against (like when y = 1, or y = 2, and so on). I have not gotten to the back propagation lectures yet, but I hope this gets covered there and that it’ll all make more sense.