## 3 Tree-Based Entropy Structured Self-Organizing Maps--Tessom
### TESSOM Algorithm  
The architecture of **TESSOM** is illustrated in Figure 2. Note that on the first level of the structure the map has a 2 \(\times\) 2 structure. This is due to the fact that when considering a rectangular lattice, these are the smallest dimensions that can be configured. The structuring levels of the tree are created from each neuron, and always with the same 2 \(\times\) 2 dimensions. That is, a root neuron will be subdivided in the next level, where all notes have the same 2 \(\times\) 2 dimensions. In Figure 2, neurons that are within the parameters for expansion are identified in orange, and neurons that do not meet one or more parameters are identified in gray, indicating that those are \"leaf\" neurons; hence, they do not generate expansion. The justification for this configuration is based on algorithms for binary or quaternary trees. It is believed that in future works it will be possible to study other types of map dimensions. Figure 1: Examples of SOM networks organized as trees [52]. Figure 2: An example of a tree generated by the TESSOM model. The fundamental process of the TESSOM algorithm is the inspection of each neuron. This means that, from a training dataset, SOM is trained using the configuration of four neurons organized in a bidimensional fashion. After training, the data subset from each neuron is analyzed using entropy to measure the level of uncertainty present in the neuron. The entropy measure for a set of two classes is performed by Equation (1), as defined by [56]:  
\[H(X)=-\sum_{i=1}^{n}P(x_{i})\log P(x_{i}) \tag{1}\]  
where \(P(x_{i})\) is the probability calculated for the class \(x_{i}\), and \(i\) represents a class among \(n\) classes. Based on a threshold value that must be parameterized in the algorithm, which must represent the overlapping level of the classes, it is decided to continue the tree growth or stop the process as a pre-pruning of the TESSOM tree. In case the threshold value is not satisfied, the objects mapped in the neuron are separated and used to train a new \(2\times 2\) map, with the same parameterizations of the first map. In order to ensure convergence and sufficient data for the subsequent level of the tree, a control parameter called _limObjects_ was designed, which defines a calculated value based on a percentage related to the neuron dataset under the dataset. The minimum value of the training data is parameterized and defines the early stop of growth, which is a second pre-pruning criterion. The algorithm represented by Figure 3 works recursively, and whenever the parameters are met by a neuron, a new recursive call is made with the objects identified by this neuron as input. This code is responsible for training the model, generates views for the model information, performs some analytical processes and then performs the model entropy calculation through Algorithm 1. In this way, the model is trained until its conditions are no longer satisfied. ```
0:\(Dataset\wedge numNeurons\)
0:\(EntropyDataset\)
1:\(EntropyDataset\Leftarrow newDataset()\)
2:for\(i=1\) to \(numNeurons\)do
3:\(Neur\Leftarrow i\)
4:\(Classes\Leftarrow distinct(Dataset.Neurons[i].Classes)\)
5:\(totClasses\Leftarrow count(Classes)\)
6:\(rowDs\Leftarrow\{Neur,totClasses\}\)
7:for each \(nomClass\) in \(Classes\)do
8:\(numObjects\Leftarrow count(Dataset.Neurons[i].Classes[nomClass])\)
9:\(numEntropy\Left Entropy(numObjects,totClasses)\)
10:\(update(rowDs)\Leftarrow\{nomClass,numObjects,numEntropy\}\)
11:endfor
12:\(insert(EntropyDataset,rowDs)\)
13:endfor
```  
**Algorithm 1** Entropy calculation. As **TESSOM** is a classification algorithm, it is possible to predict the results of new objects presented to the **TESSOM** tree. To carry out this process, each new object to be evaluated is submitted to **TESSOM**. The traverses the tree, performing a prediction through the SOM model at each level, following the branches until reaching the neurons whose parameters do not allow the generation of new models, the leaves.