# Federated Learning for Edge Computing: A Survey
## 3 Federated Learning
### Categorization  
FL can be categorized into three groups based on the various sample space and feature space distribution patterns [72], as shown in Figure 4: horizontal FL, vertical FL, and federated transfer learning.  
Horizontal FL is based on different data samples that share the same function or feature space. Two different users can collect data from different sources and create data samples. However, in the end, each user as a client can have a very similar data sample, even though the data is collected from different sources, and thus create a similar or identical feature space. Then, each client trains its local model on its data sample [73]. When two datasets' user features significantly overlap, but their users do not, horizontal FL is the best option. In horizontal FL, the datasets are divided horizontally, and a subset of the dataset is chosen for training whose user features are similar but whose users differ slightly from each other. For instance, two companies offer the same service in different areas, and their user bases are mainly unique. Nevertheless, the record user characteristics are also very similar because of their activities. In this case, horizontal FL can train the model, increasing the total number of trained samples and the model's precision. All parties typically compute and upload local gradients in horizontal FL so that the central server can combine them into a global model [7; 74]. A simple example is the already mentioned Google and its Gboard keyboard, where each Android phone user can train their local model on their data and then send it to a central server. The user is implied that even though the data may reside on the end user's device, it is consistent in feature space. Google GBoard is thus a cross-device, horizontal FL system used daily in real life.  
Due to the different feature sets, vertical FL is also known as heterogeneous FL. When user features from the two datasets do not significantly overlap, but user overlap does, vertical FL is an option. By vertically dividing the datasets, FL removes the data portions where users are identical, but user features differ slightly from training. In other words, the same user is present in data across all columns. The feature dimension of training data can therefore be increased by vertical FL [72]. Vertical FL is more challenging to implement than horizontal FL because each machine learning algorithm requires a specific learning protocol to be created. Vertical FL is better suited for joint model training between large businesses because it has a broader range of applications [75]. For example, two businesses, one an e-commerce business and the other a bank, are located in the same city. They differ in user attributes while sharing a significant portion of user sets. In this instance, vertical FL is the most appropriate method for these two businesses to jointly train a distributed model, such as the risk management model.  
Vertical and horizontal data partitioning can be considered components of federated transfer learning. When two clients have sparsely overlapping data samples and feature spaces, and we need to learn every sample label for a client, horizontal and vertical FL would be ineffective. In situations such as these, where the data sets from the two clients have different feature spaces and data samples, federated transfer learning is applicable. In other words, federated transfer learning is applicable when local client data may differ in data samples and feature space. Some frameworks allow a data scientist to train neural networks on data elements vertically partitioned among multiple owners, with the raw data remaining on the owner's device [76].