# Combining Machine Learning and Social Network Analysis to Reveal the Organizational Structures
## 2 Materials and Methods
### Collective Classification  
Collective classification is a different way of revealing company hierarchy from a graph perspective. This approach uses the connection between nodes to propagate labels within the whole network. Loopy belief propagation is an example of collective classification described in detail in References [28; 41]. Therefore, in this paper, a simplified version of this algorithm is introduced to compare with standard classification algorithms. The proposed collective classification method is presented as Algorithm 1. The first step of this algorithm is choosing a utility score and sorting all nodes according to it (line 1). The utility score can be one of the calculated features from the previous section. The next step is to reveal the labels for the given percentage of nodes of each class \(l_{i}\in L\) with the highest utility score (line 2). These nodes are marked as known (their labels are constant) and labeled \(V^{L}\), whereas the other nodes are treated as unknown \(V^{UK}\) and unlabeled. Furthermore, the propagation of labels begins in a loop until the stop condition is met or the number of iterations exceeds the given maximum number of iterations. In one iteration, each labeled node sends a message to all of its neighbors by treating edges as undirected (line 5); moreover, all received labels in a given iteration are saved for each node \(v_{i}\) in a counter \(c_{v_{i}}\) (line 6). The labels update begins after all nodes sent a message to their neighbors, so the sending order does not affect the result. If the node \(v_{i}\) has received one label more often than others (line 13), this label will be assigned to it (line 14) and the node will be additionally treated as labeled \(v_{i}\in V^{L}\) (line 15), otherwise for this node counter \(u_{v_{i}}\) will be increased (line 18). If \(u_{v_{i}}\) exceeds the maximum value (line 20), it will be reset (line 26) and the node will be assigned the label with the highest position in the company hierarchy among the labels with the highest count (lines 22 to 24). At the end of iteration the stop conditions is always checked and it is determined as a difference between sets of previous and current labels, therefore if the Jaccard coefficient is bigger than the given minimum Jaccard value and all nodes have assigned label then the algorithm will end (line 29). Additionally, in the case of unbalanced classes, the algorithm allows defining a _threshold_. During the phase of counting how many times each label was received by the node, the result for the majority class will be divided by this threshold to prevent domination of this class. (line 11)  
The collective classification algorithm was run with three parameters: number of recognized employee groups, minimum number of active months, percentage of known nodes. The first two are identical to the parameters from the previous section, but the last one determines percentage of the known (labeled) nodes. Nine values of this parameter were used from 90% to 10% with a decrease of ten percent. The manufacturing company dataset required setting threshold on the contrary to the Enron dataset where it was not necessary. Additionally, to find the best utility score experiment was carried out for all calculated features, as well as the best Jaccard value and threshold were chosen from a range of different values. The hyperparameters search space is shown in Table 11 as well as the best ones for each model in Tables 11-11.