# Modular Dynamic Neural Network: A Continual Learning Architecture
## 3 Modular Dynamic Neural Network
### Modular Dynamic Training
Each value is compared with an established threshold value, \(AV_{c}\), which makes it possible for a final decision to be made on whether a class should be considered similar, where this threshold value dictates the necessary confidence value for two classes to be considered similar. To establish this threshold value (\(AV_{c}\)), logic says it should not be too high because some similar classes could be missed, but should also not be too low so that only reasonably similar classes are considered. Different values between 0.1 and 0.5 were tested, and the best results were achieved with \(AV_{c}\) = 0.3. These tests were done with three different datasets or subsets of those datasets, namely Core50 [9], ImageNet [12] and CIFAR-10 [30]. The ideal value depends on how accurate the binary classifiers are and it essentially dictates how grouped or separated the final network is. Future work for this component includes the use of a dynamic threshold value that is re-calculated as the network expands. After comparing the averages of the classifications of all the input samples with the threshold value (\(AV_{c}\)), it is known which, if any, modules are similar to the input class. This results in one of five possible outcomes in the function of how many similar _nodes_ and/or _endpoints_ are found (see also Figure 5 left side): (a) 0 similar modules (0 similar _nodes_ and 0 similar _endpoints_); (b) 1 similar _node_ and 0 similar _endpoints_; (c) 0 similar _nodes_ and 1 similar _endpoint_; (d) more than 1 similar _node_ and/or _endpoint_ but not all, and (e) all _nodes_ and _endpoints_ are similar. Each outcome is dealt with differently, as detailed next for each case:  
1. **0 similar modules (0 similar _nodes_ and 0 similar _endpoints_)**: Place a new _endpoint_ in the current _node_ for the new class. Train the classifier for the new _endpoint_ with true data as data from the new class and false data as a balanced distribution of data (see Section 3.3 for the explanation) from the other _endpoints_ and _nodes_ present within in the current _node_. 2. **1 similar _node_ and 0 similar _endpoints_**: Enter the similar _node_ and repeat the positioning process on its children. 3. **0 similar _nodes_ and 1 similar _endpoint_**: Create a new _node_ and place a new _endpoint_ inside it for the new class as well as the _endpoint_ that was matched with the new class. Train the classifier for the new _endpoint_ with true data as data from the new class and false data as data from the class it was matched with (see Section 3.3). Retrain the classifier for the pre-existing _endpoint_ that was moved into the new _node_ with true data as the data it has stored and false data as data from the new class. **More than 1 similar _node_ and/or _endpoint_**: Create a new _node_ and place inside it a new _endpoint_ for the new class as well as all the _endpoints/nodes_ that were matched with the new class. Train the classifier for the new _endpoint_ with true data as data from the new class and false data as a balanced distribution of the data from all the other _nodes/endpoints_ it was matched with (see Section 3.3). Retrain the classifiers for all the pre-existing _nodes_ and _endpoints_ which were moved into the new _node_ using balanced distributions of their own data as true data and balanced distributions of all their sibling's data as false data. The child modules of the _nodes_ that were moved into the new _node_ do not need to be touched, as they are not dependent on their parents and only relate to each other. **All _nodes_ and _endpoints_ are similar**: Place a new _endpoint_ in the current _node_ for the new class. Train the classifier for the new _endpoint_ with true data as data from the new class and false data as a balanced distribution of data from the other endpoints and _nodes_ present in the current _node_. Retrain the classifiers for all the pre-existing _nodes_ and _endpoints_ in the current _node_ using balanced distributions of their data as true data and balanced distributions of all their sibling's data as false data.