You are on page 1of 64

Performance Evaluation and Optimization of Federated Learning

Algorithms in Edge Computing

ABSTRACT

Multi access Edge Computing (MEC) is used to move the cloud services to network edge
enabling low latency and real time processing of applications using computational offloading.
Deep Neural Networks (DNNs) for Machine Learning (ML) are gaining popularity due to
their broad range of applications, ease of implementation, and cutting-edge performance.
However, training DNNs in supervised learning can be computationally expensive and need a
large quantity of training data, especially as DNN sizes grow. DNNs have traditionally been
used in MEC to collect data from mobile phones/IoT devices/SNs, train the model in the
cloud, and then deploy the model to the edge. Users are becoming increasingly hesitant to
upload potentially sensitive data due to privacy concerns, posing the question of how these
models will be trained. On the other hand, the rapid proliferation of edge devices and the
growth of data generated at the edge have given rise to the need for efficient and privacy-
preserving machine learning approaches. Federated Learning (FL) is a new method for
training DNNs cooperatively on mobile devices without exposing private user data. Previous
research has demonstrated that non-Independent and Identically Distributed (non-IID) user
data slows down the FL algorithms' convergence speed. Furthermore, the majority of extant
FL research evaluates global-model performance. In many circumstances, such as user
content recommendation, the primary goal is to improve individual User model Accuracy
(UA). To address these issues, this work proposes a FL algorithm that introduces non-
federated Batch-Normalisation (BN) layers into the federated DNN. This benefits UA and
convergence speed by allowing users to train models personalised to their own data. This is
compatible with popular iterative FL optimisation algorithms such as Federated Averaging
(FedAvg), and the proposed system show empirically that a distributed form of Adam
optimisation (FedAvg-Adam) benefits convergence speed even further when used as the
optimisation strategy within the algorithm. Finally, this system evaluates the performance of
fed avg, fedadam, fedavg-adam algorithms for edge computing scenarios that can lead to
improved model accuracy, reduced communication overhead, and decreased energy
consumption, making it more practical and scalable for real-world edge applications.
Chapter 1

Introduction
1.1 Overview

The optimization of federated learning algorithms within the context of edge computing
represents a transformative approach to machine learning that offers significant advantages in
terms of data privacy, efficiency, and scalability. Federated learning, as a decentralized
training paradigm, enables machine learning models to be developed and updated directly on
edge devices like smartphones, IoT devices, or edge servers, avoiding the need to centralize
sensitive data in cloud servers. By optimizing these algorithms for edge computing
environments, several critical benefits are realized.

First and foremost, federated learning algorithms are designed to respect data privacy and
security. Optimizing these algorithms for edge computing allows sensitive information to
remain on the local devices where it originates, reducing the risk of data breaches and
ensuring compliance with privacy regulations.

Efficiency is another key advantage. Instead of transmitting large volumes of raw data to a
central server, only model updates or gradients are sent over the network, reducing bandwidth
and latency requirements. This is particularly advantageous for edge devices with limited
connectivity or bandwidth constraints.

Scalability is also addressed through optimization efforts. Federated learning algorithms must
be adaptable to the heterogeneity of edge devices, accommodating variations in
computational capabilities, data quality, and available resources. This ensures efficient model
training across a diverse set of edge devices.

Furthermore, optimizing federated learning algorithms allows for real-time model updates
and inference directly on edge devices. This capability is vital for applications such as
autonomous vehicles, industrial automation, and IoT devices, where low-latency, real-time
decision-making is crucial.

However, this optimization process also comes with its unique set of challenges. Algorithms
must contend with non-identically distributed data across edge devices, communication
efficiency during updates, and effective model aggregation strategies to ensure accurate and
robust learning.
1.2 Research Motivation

The motivation for conducting research and development efforts aimed at optimizing
federated learning algorithms in the context of edge computing is rooted in several pressing
and interrelated challenges that need to be addressed in the realm of machine learning and
data processing.

First and foremost, data privacy has become a paramount concern in the digital age. With the
proliferation of IoT devices and an ever-increasing volume of sensitive data being generated
at the edge, there is a critical need to ensure the security and privacy of this data. Centralized
machine learning approaches that require data to be sent to remote cloud servers pose
significant privacy risks. Federated learning, with its capacity to perform model training
directly on edge devices while keeping sensitive data localized, offers an enticing solution to
this challenge. The motivation here is to develop and optimize algorithms that empower
organizations and individuals to leverage machine learning without compromising data
privacy.

Efficiency is another driving force behind the research in this area. Traditional machine
learning models often require enormous computational resources, which may not be feasible
on resource-constrained edge devices. Optimizing federated learning algorithms for edge
computing environments is motivated by the desire to make efficient use of limited
computational capabilities while maintaining model accuracy. This efficiency is particularly
crucial for real-time or low-latency applications like autonomous vehicles or industrial
automation, where rapid decision-making is imperative.

Scalability is also a pressing concern. As the number of edge devices continues to grow
exponentially, the ability to train machine learning models efficiently and effectively across
these devices is a significant challenge. Optimizing federated learning algorithms for
scalability is motivated by the need to accommodate the diversity of edge devices, ranging
from smartphones to IoT sensors, and to ensure that machine learning can be deployed
seamlessly across this heterogeneous landscape.

Moreover, the research in this field is driven by the desire to make machine learning more
accessible and practical for a wide range of applications. By enabling on-device model
updates and inference, federated learning can bring the power of machine learning to the
edge, reducing the reliance on central cloud resources and potentially lowering costs for
businesses and organizations
1.3 Problem Statement

The problem statement underlying the optimization of federated learning algorithms in the
context of edge computing is a multifaceted challenge driven by the convergence of several
critical issues in the domains of data privacy, computational efficiency, scalability, and
accessibility of machine learning.

Data Privacy and Security: A primary concern lies in the security and privacy of data
generated and processed at the edge. Traditional centralized machine learning methods
involve the transmission of raw data to remote cloud servers for model training. This practice
raises significant privacy risks, as sensitive information may be exposed during data
transmission and storage. The problem is further exacerbated by the increasing regulatory
scrutiny and public demand for stringent data privacy protections, such as the General Data
Protection Regulation (GDPR).

Efficiency in Resource-constrained Environments: Edge devices, including IoT sensors,


smartphones, and edge servers, often operate with limited computational power, storage, and
network bandwidth. Standard machine learning models optimized for cloud-based
environments may not be suitable for these resource-constrained edge devices. Therefore,
there is a pressing need to optimize federated learning algorithms to perform efficient model
training, update, and inference on devices with varying capabilities while preserving
accuracy.

Scalability for Heterogeneous Edge Ecosystems: The rapid proliferation of edge devices
across diverse domains, such as healthcare, manufacturing, and smart cities, introduces a
challenge of managing a highly heterogeneous ecosystem. These devices vary in terms of
computational resources, data quality, and communication capabilities. Ensuring that
federated learning algorithms can effectively scale and adapt to this heterogeneity is a critical
problem. Without proper optimization, the deployment of machine learning models across a
vast array of edge devices becomes cumbersome and inefficient.

Real-time Decision-making and Accessibility: Certain applications, including autonomous


vehicles, industrial automation, and IoT-based monitoring systems, require real-time or low-
latency decision-making capabilities. Optimizing federated learning algorithms for edge
computing is driven by the need to facilitate on-device model updates and inference, enabling
rapid decision-making directly at the edge. This accessibility to real-time machine learning is
pivotal in scenarios where latency is intolerable and centralized cloud-based processing is
impractical.

Practical Implementation and Adoption: Beyond technical challenges, there is a problem


of practical implementation and adoption. Federated learning represents a paradigm shift in
how machine learning is conducted, and transitioning from traditional centralized methods to
decentralized edge-based approaches requires a paradigm shift in both technology and
organizational culture. This transition necessitates overcoming challenges related to
education, deployment frameworks, and industry standards.

1.4 Applications

The optimization of federated learning algorithms in the context of edge computing opens up
a wide array of applications that can significantly impact various industries and domains.
These applications leverage the advantages of privacy-preserving, efficient, and scalable
machine learning directly on edge devices. Here are detailed explanations of some key
applications:

 Healthcare: In healthcare, patient data privacy is paramount. Federated learning


enables medical institutions to train predictive models for disease diagnosis, treatment
recommendations, and patient monitoring directly on medical devices or smartphones.
Optimized algorithms ensure that sensitive health data remains on the device while
still contributing to improved medical outcomes.

 Autonomous Vehicles: Real-time decision-making is critical for autonomous vehicles.


Federated learning optimization allows self-driving cars to update their perception
models on-board, adapting to changing road conditions and ensuring safety without
reliance on a central cloud. This enhances the responsiveness and safety of
autonomous transportation.

 Smart Manufacturing: Edge devices in manufacturing settings can use federated


learning to optimize production processes, predict equipment failures, and enhance
quality control. The algorithms can be fine-tuned to the specific needs of different
manufacturing facilities while preserving proprietary data.

 Agriculture: Farmers and agricultural equipment manufacturers can utilize federated


learning to improve crop yields and resource management. Edge devices, such as
sensors and drones, can collect data on soil conditions and crop health, enabling
localized model training for precision agriculture.

 Retail and Customer Personalization: Retailers can employ federated learning to


create personalized shopping experiences for customers. Optimized algorithms run on
in-store cameras or customers' smartphones to analyse shopping behaviours and
preferences, offering tailored product recommendations without compromising
individual privacy.

 Energy Management: Optimizing energy consumption in smart grids and smart homes
is vital for sustainability. Federated learning on edge devices can predict energy
demand, optimize consumption patterns, and enable load balancing, all while
preserving user data privacy.

 Natural Disaster Prediction: Edge devices in disaster-prone areas, such as weather


stations and seismic sensors, can use federated learning to enhance early warning
systems. Real-time data analysis enables faster and more accurate prediction of
natural disasters like hurricanes, earthquakes, and floods.

 Smart Cities: Federated learning contributes to the development of smart city


solutions by enabling localized data processing and analysis for traffic management,
waste management, and environmental monitoring. Algorithms can be customized for
each city's unique requirements.

 Education: In educational settings, personalized learning experiences can be created


by optimizing federated learning algorithms on students' devices. This approach
tailors educational content and recommendations while maintaining the
confidentiality of student data.

 Financial Services: Financial institutions can leverage federated learning to enhance


fraud detection and risk assessment. Optimized algorithms on mobile banking apps
and POS terminals can analyse transaction data for anomalies and potential threats
without exposing sensitive financial information.

 Environmental Monitoring: Federated learning at the edge is valuable for


environmental conservation efforts. Devices like drones and sensors can collect data
on wildlife behavior, air quality, and habitat changes, supporting research and
conservation efforts.
These applications showcase the versatility and transformative potential of optimized
federated learning algorithms in edge computing. They enable industries to harness the
benefits of machine learning while respecting data privacy, ensuring efficient use of
resources, and accommodating the diverse needs of various domains. As the adoption of edge
computing continues to grow, these applications will play a pivotal role in shaping the future
of technology and data-driven decision-making across sectors.
Chapter 2

Literature Survey

With the continuous development of the Internet of Things (IoT) and edge computing
technology, privacy issues in edge computing for IoT have become increasingly prominent
[1]. Personal privacy and data leakage are among the most prominent issues. Due to the large
number of sensors and devices involved in IoT, they continuously collect and transmit
various types of data, including personal identification information, geographic location
information, health status information, and so on [2]. If these data are obtained by malicious
individuals, it could pose significant security threats and privacy risks. Another privacy issue
is data security. Data in IoT are usually scattered among different devices, cloud servers, edge
nodes, and sensors. These data need to be transmitted and stored, and the networks and
devices used for transmitting and storing data face various security threats. For example,
there may be hackers attacking the network, data centers being stolen, edge devices being
eavesdropped or tampered with, and so on. These issues could all lead to data leakage and
security risks. In addition, due to the inconsistency of data formats and standards among
different devices and systems, data cannot be effectively shared and utilized, resulting in the
problem of data silos. This not only limits the application and effectiveness of IoT but also
leads to inefficiency in data management and analysis. This is because many data are stored
and processed in isolation on different devices or systems, resulting in data fragmentation and
the inability to achieve complete data analysis and application. With the growth of data and
the increase in data transmission, IoT edge computing systems must handle more and more
sensitive data, including personal privacy data and business confidential data. However,
privacy and data silos are not only challenges faced by IoT edge computing but also
important obstacles restricting the development of IoT technology. In order to solve these
problems, federated learning has become an important solution.

Federated learning is a distributed machine learning approach that allows multiple devices or
data sources to collaborate in learning without exposing raw data [3,4]. This approach not
only reduces the cost of data transmission and storage, but also better protects privacy and
data security, thereby avoiding privacy leaks and data loss issues. By training models without
sharing data, federated learning protects the privacy of users participating in the training and
improves the privacy protection and training effectiveness of edge computing in the IoT [5].
However, in the edge computing environment of the IoT, the application of federated learning
faces many challenges, the most significant of which are heterogeneous devices and
malicious nodes. Heterogeneous devices refer to devices participating in federated learning
that have different computing capabilities, bandwidth, and data, which leads to training
imbalance and instability [6,7]. Moreover, this leads to a high dimensionality of the solution
space for the node selection problem in federation learning. Heuristic algorithms are prone to
fall into local optimal solutions and fail to find global optimal solutions when faced with such
complex problems. In federated learning, each device only uses its own local data for
training, so the computing power and data quality of the device have a direct impact on the
effectiveness of federated learning [8,9]. At the same time, network bandwidth between
devices can also affect the training speed and effectiveness of federated learning. In federated
learning, each participant, as a node, trains local data and then uploads the trained model
parameters to the server for global model updates [10]. Due to the diversity and uncertainty
of participants, the presence of malicious nodes may have a serious impact on the training
effectiveness of federated learning [11,12].

2.1. Federated Learning

In addition to privacy and security issues, the uneven distribution of data, communication
network resources and computing resources will lead to low efficiency of model training. In
order to further optimize the model iterative updating process and improve the efficiency of
federated learning, researchers have conducted a lot of related research on these problems and
different scenarios [13,14,15]. Because the training process of federated learning needs many
iterations to update the training parameters, it causes a large communication overhead. Some
researchers have performed research on optimizing the communication process for this
problem. One of the research directions is the method of compressing the data that need to be
updated by the model. For example, Sattle et al. [16] proposed a compression framework of
sparse ternary compression. This framework extends the existing compression technology of
Top-k gradient thinning through a novel mechanism for the existing federated learning
compression methods that either only compress the upstream communication from the client
to the server (without compressing the downstream communication), or only perform well
under ideal conditions (e.g., independent and identical distribution). The hierarchical and
optimal Golomb coding of downstream compression and weight updating is realized so that
the federated learning communication mode is optimized, especially in the learning
environment with limited bandwidth. The research direction of some researchers is to design
new mechanisms and learning algorithms. Mills et al. [17] proposed a multi-task joint
learning system, which benefits the accuracy of user models by using distributed Adam
optimization and introducing a non-joint patch batch standardization layer, and only needs to
upload a certain proportion of user data for model integration each time the model is updated.
Guo et al. [18] proposed a novel design of a transceiver and learning algorithm that simulates
the analog gradient aggregation (AGA) solution, which significantly reduces the multi-
channel access delay. Wu et al. [19] proposed a framework for automatically selecting the
most representative data from unlabeled input streams so as not to accumulate a large number
of data sets due to the storage limitations of edge devices and proposed a data-replacement
strategy based on contrast scores, that is, measuring the representation quality of each data
without using labels, indicating that the data with low quality are not effectively learned by
the model and will remain in the buffer for further learning, while data representing high
quality are discarded.

2.2. Federated Learning Based on Edge Computing

As an extension of cloud computing, edge computing deploys computing resources in the


edge network near the user side [20,21,22,23]. The terminal equipment can directly perform
data analysis, storage and calculation at the edge node, realizing the service requirements of
low delay, short communication distance and high reliability. As a learning mode for long-
time distributed interaction with terminal devices, federated learning can effectively improve
the performance of federated learning if edge computing can be used for task training or
merging in advance. However, generally, edge nodes are different from cloud computing
centers, in that their computing and communication resources are limited. Under the
framework of a large-scale federal learning network, a large number of terminals will
communicate and calculate based on edge computing, which is prone to the problem of
communication bottlenecks and uneven resources, resulting in delay “short board”.
Therefore, it is necessary to optimize resource scheduling under federated learning based on
edge computing. First, based on the traditional federal learning framework, Shi et al. [24]
proposed a joint equipment scheduling and resource allocation strategy. According to the
number of training rounds and the number of scheduled equipment in each round,
communication and computing resources are jointly considered, and a greedy equipment
scheduling algorithm is designed to maximize the model accuracy under the condition of time
constraints. Liu et al. [25] considered that in the federated learning scenario based on edge
computing, by splitting the model, some models are reserved for local training, and the rest of
the models are unloaded to edge nodes for training, thus reducing the training task of end
users but at the same time increasing the overhead of the communication resources. Zhang et
al. [26] proposed a federal learning-based service function chain mapping algorithm to solve
the resource allocation problem of air–space integration networks and effectively improve
resource utilization.

In addition, some researchers innovated and optimized the framework of federal learning.
Luo et al. [27] introduced a novel hierarchical joint edge learning framework, in which some
model aggregations are migrated from the cloud to the edge server, and further optimized the
joint consideration of computing and communication resource allocation and edge association
of devices under the hierarchical joint edge learning framework. Hosseinalipour et al. [28]
proposed a multi-layer federated learning framework in heterogeneous networks, which takes
into account the heterogeneity of the network structure, device computing capacity and data
distribution, and realizes efficient federated learning by offloading learning tasks and
allocating communication and computing resources accordingly. Xue et al. [29] implemented
a clinical decision support system based on federated learning in edge computing networks.
The double deep Q network was deployed at the edge node, and a stable and orderly clinical
treatment strategy was obtained. Considering the constraints of link limitation, delay
limitation and energy limitation, Lyapunov optimization was used to improve the
convergence of the system.
Chapter 3

EXISTING SYSTEM

3.1 Existing analysis

Naive Bayes algorithm is a probabilistic learning method that is mostly used in Natural
Language Processing (NLP). The algorithm is based on the Bayes theorem and predicts the
tag of a text such as a piece of email or newspaper article. It calculates the probability of each
tag for a given sample and then gives the tag with the highest probability as output. Naive
Bayes classifier is a collection of many algorithms where all the algorithms share one
common principle, and that is each feature being classified is not related to any other feature.
The presence or absence of a feature does not affect the presence or absence of the other
feature.

Naïve Bayes algorithm is a supervised learning algorithm, which is based on Bayes theorem
and used for solving classification problems. ... Naïve Bayes Classifier is one of the simple
and most effective Classification algorithms which helps in building the fast machine
learning models that can make quick predictions. Naive Bayes is a powerful algorithm that is
used for text data analysis and with problems with multiple classes. To understand Naive
Bayes theorem’s working, it is important to understand the Bayes theorem concept first as it
is based on the latter.

Bayes theorem, formulated by Thomas Bayes, calculates the probability of an event occurring
based on the prior knowledge of conditions related to an event. It is based on the following
formula:

P( A∨B)=P( A)∗P(B∨A )/P (B)

Where we are calculating the probability of class A when predictor B is already provided.
P(B) = prior probability of B

P(A) = prior probability of class A

P(B|A) = occurrence of predictor B given class A probability

3.2 Drawbacks

The Naive Bayes algorithm has the following disadvantages:

 Independence Assumption: The Naive Bayes algorithm assumes that features are
conditionally independent, which means it assumes that the presence or absence of
one feature is not related to the presence or absence of other features. In real-world
malware detection, this assumption often doesn't hold because malware can exhibit
complex and interrelated behaviors. Malware can use multiple techniques and
components that work together, and the independence assumption may lead to
inaccurate results.
 Limited Feature Engineering: Naive Bayes relies heavily on the quality and relevance
of features used for classification. In malware detection, it can be challenging to
extract meaningful and discriminating features, especially when dealing with
polymorphic or obfuscated malware that changes its code to evade detection. More
advanced techniques like deep learning and behavior analysis may capture more
nuanced patterns.
 Imbalanced Data: Malware detection datasets are often imbalanced, with a
significantly larger number of non-malware samples compared to malware samples.
Naive Bayes can be sensitive to imbalanced data because it may result in biased
classification towards the majority class. Techniques like resampling or different cost-
sensitive learning approaches may be needed to address this issue.
 Lack of Robustness: Naive Bayes is not robust to outliers or noisy data. Malware
detection datasets can be noisy and contain outliers due to various reasons, such as
mislabeled samples or variations in malware behavior. Naive Bayes may be sensitive
to such anomalies, potentially leading to false positives or false negatives.
 Limited Detection of Advanced Threats: Naive Bayes may struggle to detect highly
advanced and targeted malware attacks that employ sophisticated evasion techniques.
These threats often require more complex and adaptive detection methods, such as
machine learning models with deep feature representations or behavioral analysis.
 Scalability: In large-scale malware detection scenarios, the scalability of Naive Bayes
may become an issue, especially when dealing with a vast number of features or a
high volume of incoming data. More scalable algorithms or distributed computing
frameworks may be necessary for handling such workloads.

Chapter 4
Proposed System
4.1 Overview

This procedure outlines the fundamental steps involved in conducting research on federated
learning in an edge computing environment. The research would likely involve evaluating the
performance of this process, optimizing the algorithms used for federated learning, and
possibly exploring ways to enhance the efficiency of model aggregation and communication
in edge computing scenarios. Figure 4.1 shows the proposed system model. The detailed
operation illustrated as follows:

Step 1: Send work requests to clients (Work Request) In this step, the research begins by
initiating work requests to a group of client devices or nodes within an edge computing
network. These work requests likely contain instructions or tasks that need to be performed
by the clients as part of the federated learning process.

Step 2: Accept/Reject work request (Client Accept): After receiving the work requests, the
client devices have the option to either accept or reject the assigned tasks. Clients may
evaluate factors such as their computational capacity, available resources, and current
workloads to make this decision.

Step 3: Receive global model, augment with personal patches (Global Model Download)
Once the clients accept the work requests, they receive a global model from a central server
or coordinator. Clients may also be required to augment this global model with personal
patches or updates specific to their own data or circumstances.

Step 4: Train using Federated Learning framework (Upload non-private layers): Clients
perform training using a federated learning framework. This means that they update the
global model based on their local data without sharing sensitive information. Typically, only
non-private layers of the model are uploaded to protect user privacy.

Step 5: Wait for clients to upload in parallel: After training their local models, clients are
expected to upload their model updates to the central server or coordinator in parallel with
other clients. This step ensures that multiple clients can contribute their knowledge to the
global model simultaneously.

Step 6: Aggregate client models (Save global model): In the final step, the central server or
coordinator aggregates the model updates received from all the clients. This aggregation
process aims to create an updated global model that incorporates the knowledge from all
participating clients. The resulting global model is then saved for future use and can be
further iterated upon in subsequent rounds of federated learning.

Fig. 4.1: Proposed block diagram.

4.2 Data preprocessing

Data pre-processing is a process of preparing the raw data and making it suitable for a
machine learning model. It is the first and crucial step while creating a machine learning
model. When creating a machine learning project, it is not always a case that we come across
the clean and formatted data. And while doing any operation with data, it is mandatory to
clean it and put in a formatted way. So, for this, we use data pre-processing task.
A real-world data generally contains noises, missing values, and maybe in an unusable format
which cannot be directly used for machine learning models. Data pre-processing is required
tasks for cleaning the data and making it suitable for a machine learning model which also
increases the accuracy and efficiency of a machine learning model.

One-Hot Encoding: Categorical variables are one-hot encoded to convert them into a
numerical format suitable for machine learning models. The code uses the pd.get_dummies()
function to create binary columns for each category within categorical. This transformation
allows machine learning algorithms to work with categorical data effectively.

Standardization: Standard Scaler is applied to scale numeric features, ensuring that they
have a mean of 0 and a standard deviation of 1. The 'Standard Scaler' from scikit-learn is used
to standardize specific numeric features. Standardization is a common preprocessing step to
bring features to a similar scale, which can improve the performance of some machine
learning algorithms. This transformation is important for several reasons:

 Equal Scaling: Standard Scaler scales each feature to have the same scale. This is
crucial for algorithms that are sensitive to the scale of features, such as gradient-based
optimization algorithms (e.g., in neural networks) and distance-based algorithms (e.g.,
k-means clustering).

 Mean Centering: By subtracting the mean from each data point, Standard Scaler
centers the data around zero. This can help algorithms converge faster during training
and improve their performance.

 Normalization: Scaling by the standard deviation normalizes the data, ensuring that
features have comparable variances. This can prevent certain features from
dominating others in the modelling process.

 Interpretability: Standardized data is more interpretable because it puts all features


on a common scale, making it easier to compare the relative importance of features.

4.3 Dataset Splitting

In machine learning data pre-processing, we divide our dataset into a training set and test set.
This is one of the crucial steps of data pre-processing as by doing this, we can enhance the
performance of our machine learning model. Suppose if we have given training to our
machine learning model by a dataset and we test it by a completely different dataset. Then, it
will create difficulties for our model to understand the correlations between the models. If we
train our model very well and its training accuracy is also very high, but we provide a new
dataset to it, then it will decrease the performance. So, we always try to make a machine
learning model which performs well with the training set and with the test dataset.

Training Set: A subset of dataset to train the machine learning model, and we already know
the output.

Test set: A subset of dataset to test the machine learning model, and by using the test set,
model predicts the output.

4.4 Federated learning

Federated learning (often referred to as collaborative learning) is a decentralized approach to


training machine learning models. It doesn’t require an exchange of data from client devices
to global servers. Instead, the raw data on edge devices is used to train the model locally,
increasing data privacy. The final model is formed in a shared manner by aggregating the
local updates.

Privacy: In contrast to traditional methods where data is sent to a central server for training,
federated learning allows for training to occur locally on the edge device, preventing potential
data breaches.

Data security: Only the encrypted model updates are shared with the central server, assuring
data security. Additionally, secure aggregation techniques such as Secure Aggregation
Principle allow the decryption of only aggregated results.

Access to heterogeneous data: Federated learning guarantees access to data spread across
multiple devices, locations, and organizations. It makes it possible to train models on
sensitive data, such as financial or healthcare data while maintaining security and privacy.
And thanks to greater data diversity, models can be made more generalizable.

Federated learning working: A generic baseline model is stored at the central server. The
copies of this model are shared with the client devices, which then train the models based on
the local data they generate. Over time, the models on individual devices become
personalized and provide a better user experience.

In the next stage, the updates (model parameters) from the locally trained models are shared
with the main model located at the central server using secure aggregation techniques. This
model combines and averages different inputs to generate new learnings. Since the data is
collected from diverse sources, there is greater scope for the model to become generalizable.

Once the central model has been re-trained on new parameters, it’s shared with the client
devices again for the next iteration. With every cycle, the models gather a varied amount of
information and improve further without creating privacy breaches.

Figure 4.2. Federated learning working.

Types of federated learning

Centralized federated learning: Centralized federated learning requires a central server. It


coordinates the selection of client devices in the beginning and gathers the model updates
during training. The communication happens only between the central server and individual
edge devices.
Figure 4.3. Centralized federated learning. The updates from multiple users (B) are passed to
a global model, and the cycle repeats (source)

While this approach looks straightforward and generates accurate models, the central server
poses a bottleneck problem—network failures can halt the complete process.

Decentralized federated learning: Decentralized federated learning does not require a


central server to coordinate the learning. Instead, the model updates are shared only among
the interconnected edge devices. The final model is obtained on an edge device by
aggregating the local updates of the connected edge devices. This approach prevents the
possibility of a single-point failure; however, the model's accuracy is completely dependent
on the network topology of the edge devices.
Figure 4.4. decentralized federated learning

Heterogeneous federated learning: Heterogeneous federated learning involves having


heterogeneous clients such as mobile phones, computers, or IoT (Internet of Things) devices.
These devices may differ in terms of hardware, software, computation capabilities, and data
types. HeteroFL was developed in response to the common Federated Learning strategies
that assume the local models’ attributes resemble those of the main model. But in the real
world, it happens very rarely. HeteroFL can generate a single global model for inference after
training over multiple varied local models.

Federated learning algorithms

Federated stochastic gradient descent (FedSGD): In traditional SGD, the gradients are
computed on mini-batches, which are a fraction of data samples obtained from the total
samples. In the federated setting, these mini-batches can be considered different client
devices that comprise local data. In FedSGD, the central model is distributed to the clients,
and each client computes the gradients using local data. These gradients are then passed to
the central server, which aggregates the gradients in proportion to the number of samples
present on each client to calculate the gradient descent step.
Federated averaging (FedAvg): Federated averaging is an extension of the FedSGD
algorithm. Clients can perform more than one local gradient descent update. Instead of
sharing the gradients with the central server, weights tuned on the local model are shared.
Finally, the server aggregates the clients' weights (model parameters). Federated Averaging is
a generalization of FedSGD—if all the clients begin from the same initialization, averaging
the gradients is equal to averaging the weights. Therefore, Federated Averaging leaves room
for tuning the local weights before sending them to the central server for averaging.

Federated learning with dynamic regularization (FedDyn): Regularization in traditional


machine learning methods aims to add a penalty to the loss function to improve
generalization. In federated learning, the global loss must be computed based on local losses
generated from heterogeneous devices. Due to the heterogeneity of clients, minimizing global
loss is different than minimizing local losses. Therefore, FedDyn method aims to generate the
regularization term for local losses by adapting to the data statistics, such as the amount of
data or communication cost. This modification of local losses through dynamic regularization
enables local losses to converge to the global loss.

4.5 Advantages
The outlined procedure for conducting research on federated learning algorithms in edge
computing offers several distinct advantages, each contributing to the effectiveness and
efficiency of machine learning models in decentralized environments.
Firstly, by sending work requests to clients and allowing them to accept or reject tasks based
on their computational capabilities and workloads, this approach promotes flexibility and
resource utilization efficiency. Clients can participate in federated learning when it's
convenient for them, ensuring that the edge devices are not overwhelmed and can continue
serving their primary functions.
Secondly, the process of receiving a global model and augmenting it with personal patches
ensures that the federated learning model remains adaptable and relevant to the specific
context of each client. This personalization not only enhances the accuracy of the model but
also addresses privacy concerns by allowing clients to control the information shared.
Thirdly, training using a federated learning framework, where only non-private layers are
uploaded, strikes a balance between model accuracy and data privacy. It enables clients to
contribute valuable insights from their local data without compromising sensitive
information, making it suitable for applications in healthcare, finance, and other data-
sensitive domains.
Furthermore, the parallel uploading of model updates in Step 5 enhances the efficiency of the
federated learning process. Clients can transmit their updates simultaneously, reducing
latency and speeding up the overall model aggregation process.
Lastly, the model aggregation in Step 6 enables the creation of a robust and representative
global model by combining the knowledge of all participating clients. This collaborative
approach leverages the collective intelligence of edge devices, leading to a more accurate and
comprehensive machine learning model.

Chapter 5

UML DAIGRAMS

UML stands for Unified Modelling Language. UML is a standardized general-purpose


modelling language in the field of object-oriented software engineering. The standard is
managed, and was created by, the Object Management Group.
The goal is for UML to become a common language for creating models of object-oriented
computer software. In its current form UML is comprised of two major components: a Meta-
model and a notation. In the future, some form of method or process may also be added to; or
associated with, UML.

The Unified Modelling Language is a standard language for specifying, Visualization,


Constructing and documenting the artifacts of software system, as well as for business
modelling and other non-software systems. The UML represents a collection of best
engineering practices that have proven successful in the modelling of large and complex
systems. The UML is a very important part of developing objects-oriented software and the
software development process. The UML uses mostly graphical notations to express the
design of software projects.

GOALS

The Primary goals in the design of the UML are as follows:

 Provide users a ready-to-use, expressive visual modeling Language so that they can
develop and exchange meaningful models.
 Provide extendibility and specialization mechanisms to extend the core concepts.
 Be independent of particular programming languages and development process.
 Provide a formal basis for understanding the modeling language.
 Encourage the growth of OO tools market.
 Support higher level development concepts such as collaborations, frameworks,
patterns and components.
 Integrate best practices.

Class Diagram: Class diagram is a static diagram. It represents the static view of an
application.
Sequence Diagram: Sequence diagrams are used to capture the order of messages flowing
from one object to another.
Activity diagram: Activity diagram is basically a flowchart to represent the flow from one
activity to another activity.

Deployment diagram: Deployment diagrams are used to visualize the topology of the
physical components of a system, where the software components are deployed.
Chapter 6

SOFTWARE ENVIRONMENT
What is Python?

Below are some facts about Python.

 Python is currently the most widely used multi-purpose, high-level programming


language.

 Python allows programming in Object-Oriented and Procedural paradigms. Python


programs generally are smaller than other programming languages like Java.

 Programmers have to type relatively less and indentation requirement of the language,
makes them readable all the time.

 Python language is being used by almost all tech-giant companies like – Google,
Amazon, Facebook, Instagram, Dropbox, Uber… etc.

The biggest strength of Python is huge collection of standard libraries which can be used for
the following –

 Machine Learning

 GUI Applications (like Kivy, Tkinter, PyQt etc.)

 Web frameworks like Django (used by YouTube, Instagram, Dropbox)

 Image processing (like Opencv, Pillow)

 Web scraping (like Scrapy, BeautifulSoup, Selenium)

 Test frameworks

 Multimedia

Advantages of Python

Let’s see how Python dominates over other languages.

1. Extensive Libraries

Python downloads with an extensive library and it contain code for various purposes like
regular expressions, documentation-generation, unit-testing, web browsers, threading,
databases, CGI, email, image manipulation, and more. So, we don’t have to write the
complete code for that manually.

2. Extensible

As we have seen earlier, Python can be extended to other languages. You can write some of
your code in languages like C++ or C. This comes in handy, especially in projects.

3. Embeddable

Complimentary to extensibility, Python is embeddable as well. You can put your Python code
in your source code of a different language, like C++. This lets us add scripting capabilities to
our code in the other language.

4. Improved Productivity

The language’s simplicity and extensive libraries render programmers more productive than
languages like Java and C++ do. Also, the fact that you need to write less and get more things
done.

5. IOT Opportunities

Since Python forms the basis of new platforms like Raspberry Pi, it finds the future bright for
the Internet of Things. This is a way to connect the language with the real world.

6. Simple and Easy

When working with Java, you may have to create a class to print ‘Hello World’. But in
Python, just a print statement will do. It is also quite easy to learn, understand, and code. This
is why when people pick up Python, they have a hard time adjusting to other more verbose
languages like Java.

7. Readable

Because it is not such a verbose language, reading Python is much like reading English. This
is the reason why it is so easy to learn, understand, and code. It also does not need curly
braces to define blocks, and indentation is mandatory. These further aids the readability of the
code.

8. Object-Oriented
This language supports both the procedural and object-oriented programming paradigms.
While functions help us with code reusability, classes and objects let us model the real world.
A class allows the encapsulation of data and functions into one.

9. Free and Open-Source

Like we said earlier, Python is freely available. But not only can you download Python for
free, but you can also download its source code, make changes to it, and even distribute it. It
downloads with an extensive collection of libraries to help you with your tasks.

10. Portable

When you code your project in a language like C++, you may need to make some changes to
it if you want to run it on another platform. But it isn’t the same with Python. Here, you need
to code only once, and you can run it anywhere. This is called Write Once Run Anywhere
(WORA). However, you need to be careful enough not to include any system-dependent
features.

11. Interpreted

Lastly, we will say that it is an interpreted language. Since statements are executed one by
one, debugging is easier than in compiled languages.

Any doubts till now in the advantages of Python? Mention in the comment section.

Advantages of Python Over Other Languages

1. Less Coding

Almost all of the tasks done in Python requires less coding when the same task is done in
other languages. Python also has an awesome standard library support, so you don’t have to
search for any third-party libraries to get your job done. This is the reason that many people
suggest learning Python to beginners.

2. Affordable

Python is free therefore individuals, small companies or big organizations can leverage the
free available resources to build applications. Python is popular and widely used so it gives
you better community support.

The 2019 Github annual survey showed us that Python has overtaken Java in the most
popular programming language category.
3. Python is for Everyone

Python code can run on any machine whether it is Linux, Mac or Windows. Programmers
need to learn different languages for different jobs but with Python, you can professionally
build web apps, perform data analysis and machine learning, automate things, do web
scraping and also build games and powerful visualizations. It is an all-rounder programming
language.

Disadvantages of Python

So far, we’ve seen why Python is a great choice for your project. But if you choose it, you
should be aware of its consequences as well. Let’s now see the downsides of choosing Python
over another language.

1. Speed Limitations

We have seen that Python code is executed line by line. But since Python is interpreted, it
often results in slow execution. This, however, isn’t a problem unless speed is a focal point
for the project. In other words, unless high speed is a requirement, the benefits offered by
Python are enough to distract us from its speed limitations.

2. Weak in Mobile Computing and Browsers

While it serves as an excellent server-side language, Python is much rarely seen on the client-
side. Besides that, it is rarely ever used to implement smartphone-based applications. One
such application is called Carbonnelle.

The reason it is not so famous despite the existence of Brython is that it isn’t that secure.

3. Design Restrictions

As you know, Python is dynamically-typed. This means that you don’t need to declare the
type of variable while writing the code. It uses duck-typing. But wait, what’s that? Well, it
just means that if it looks like a duck, it must be a duck. While this is easy on the
programmers during coding, it can raise run-time errors.

4. Underdeveloped Database Access Layers

Compared to more widely used technologies like JDBC (Java DataBase


Connectivity) and ODBC (Open DataBase Connectivity), Python’s database access layers are
a bit underdeveloped. Consequently, it is less often applied in huge enterprises.

5. Simple
No, we’re not kidding. Python’s simplicity can indeed be a problem. Take my example. I
don’t do Java, I’m more of a Python person. To me, its syntax is so simple that the verbosity
of Java code seems unnecessary.

This was all about the Advantages and Disadvantages of Python Programming Language.

History of Python

What do the alphabet and the programming language Python have in common? Right, both
start with ABC. If we are talking about ABC in the Python context, it's clear that the
programming language ABC is meant. ABC is a general-purpose programming language and
programming environment, which had been developed in the Netherlands, Amsterdam, at the
CWI (Centrum Wiskunde &Informatica). The greatest achievement of ABC was to influence
the design of Python. Python was conceptualized in the late 1980s. Guido van Rossum
worked that time in a project at the CWI, called Amoeba, a distributed operating system. In
an interview with Bill Venners1, Guido van Rossum said: "In the early 1980s, I worked as an
implementer on a team building a language called ABC at Centrum voor Wiskunde en
Informatica (CWI). I don't know how well people know ABC's influence on Python. I try to
mention ABC's influence because I'm indebted to everything I learned during that project and
to the people who worked on it. "Later on in the same Interview, Guido van Rossum
continued: "I remembered all my experience and some of my frustration with ABC. I decided
to try to design a simple scripting language that possessed some of ABC's better properties,
but without its problems. So I started typing. I created a simple virtual machine, a simple
parser, and a simple runtime. I made my own version of the various ABC parts that I liked. I
created a basic syntax, used indentation for statement grouping instead of curly braces or
begin-end blocks, and developed a small number of powerful data types: a hash table (or
dictionary, as we call it), a list, strings, and numbers."

Python Development Steps

Guido Van Rossum published the first version of Python code (version 0.9.0) at alt. sources
in February 1991. This release included already exception handling, functions, and the core
data types of lists, dict.., str and others. It was also object oriented and had a module system.
Python version 1.0 was released in January 1994. The major new features included in this
release were the functional programming tools lambda, map, filter and reduce, which Guido
Van Rossum never liked. Six and a half years later in October 2000, Python 2.0 was
introduced. This release included list comprehensions, a full garbage collector and it was
supporting Unicode. Python flourished for another 8 years in the versions 2.x before the next
major release as Python 3.0 (also known as "Python 3000" and "Py3K") was released. Python
3 is not backwards compatible with Python 2.x. The emphasis in Python 3 had been on the
removal of duplicate programming constructs and modules, thus fulfilling or coming close to
fulfilling the 13th law of the Zen of Python: "There should be one -- and preferably only one
-- obvious way to do it. " Some changes in Python 7.3:

 Print is now a function.


 Views and iterators instead of lists
 The rules for ordering comparisons have been simplified. E.g., a heterogeneous list
cannot be sorted, because all the elements of a list must be comparable to each
other.
 There is only one integer type left, i.e., int. long is int as well.
 The division of two integers returns a float instead of an integer. "//" can be used to
have the "old" behavior.
 Text Vs. Data Instead of Unicode Vs. 8-bit
Purpose

We demonstrated that our approach enables successful segmentation of intra-retinal layers—


even with low-quality images containing speckle noise, low contrast, and different intensity
ranges throughout—with the assistance of the ANIS feature.

Python

Python is an interpreted high-level programming language for general-purpose programming.


Created by Guido van Rossum and first released in 1991, Python has a design philosophy that
emphasizes code readability, notably using significant whitespace.

Python features a dynamic type system and automatic memory management. It supports
multiple programming paradigms, including object-oriented, imperative, functional and
procedural, and has a large and comprehensive standard library.

 Python is Interpreted − Python is processed at runtime by the interpreter. You do not


need to compile your program before executing it. This is similar to PERL and PHP.
 Python is Interactive − you can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
Python also acknowledges that speed of development is important. Readable and terse code is
part of this, and so is access to powerful constructs that avoid tedious repetition of code.
Maintainability also ties into this may be an all but useless metric, but it does say something
about how much code you have to scan, read and/or understand to troubleshoot problems or
tweak behaviours. This speed of development, the ease with which a programmer of other
languages can pick up basic Python skills and the huge standard library is key to another area
where Python excels. All its tools have been quick to implement, saved a lot of time, and
several of them have later been patched and updated by people with no Python background -
without breaking.

Modules Used in Project

TensorFlow

TensorFlow is a free and open-source software library for dataflow and differentiable
programming across a range of tasks. It is a symbolic math library and is also used
for machine learning applications such as neural networks. It is used for both research and
production at Google.‍

TensorFlow was developed by the Google Brain team for internal Google use. It was released
under the Apache 2.0 open-source license on November 9, 2015.

NumPy

NumPy is a general-purpose array-processing package. It provides a high-performance


multidimensional array object, and tools for working with these arrays.

It is the fundamental package for scientific computing with Python. It contains various
features including these important ones:

 A powerful N-dimensional array object


 Sophisticated (broadcasting) functions
 Tools for integrating C/C++ and Fortran code
 Useful linear algebra, Fourier transform, and random number capabilities
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional
container of generic data. Arbitrary datatypes can be defined using NumPy which allows
NumPy to seamlessly and speedily integrate with a wide variety of databases.

Pandas
Pandas is an open-source Python Library providing high-performance data manipulation and
analysis tool using its powerful data structures. Python was majorly used for data munging
and preparation. It had very little contribution towards data analysis. Pandas solved this
problem. Using Pandas, we can accomplish five typical steps in the processing and analysis
of data, regardless of the origin of data load, prepare, manipulate, model, and analyse. Python
with Pandas is used in a wide range of fields including academic and commercial domains
including finance, economics, Statistics, analytics, etc.

Matplotlib

Matplotlib is a Python 2D plotting library which produces publication quality figures in a


variety of hardcopy formats and interactive environments across platforms. Matplotlib can be
used in Python scripts, the Python and IPython shells, the Jupyter Notebook, web application
servers, and four graphical user interface toolkits. Matplotlib tries to make easy things easy
and hard things possible. You can generate plots, histograms, power spectra, bar charts, error
charts, scatter plots, etc., with just a few lines of code. For examples, see the sample
plots and thumbnail gallery.

For simple plotting the pyplot module provides a MATLAB-like interface, particularly when
combined with IPython. For the power user, you have full control of line styles, font
properties, axes properties, etc, via an object-oriented interface or via a set of functions
familiar to MATLAB users.

Scikit – learn

Scikit-learn provides a range of supervised and unsupervised learning algorithms via a


consistent interface in Python. It is licensed under a permissive simplified BSD license and is
distributed under many Linux distributions, encouraging academic and commercial use.
Python

Python is an interpreted high-level programming language for general-purpose programming.


Created by Guido van Rossum and first released in 1991, Python has a design philosophy that
emphasizes code readability, notably using significant whitespace.

Python features a dynamic type system and automatic memory management. It supports
multiple programming paradigms, including object-oriented, imperative, functional and
procedural, and has a large and comprehensive standard library.

 Python is Interpreted − Python is processed at runtime by the interpreter. You do not


need to compile your program before executing it. This is similar to PERL and PHP.
 Python is Interactive − you can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
Python also acknowledges that speed of development is important. Readable and terse code is
part of this, and so is access to powerful constructs that avoid tedious repetition of code.
Maintainability also ties into this may be an all but useless metric, but it does say something
about how much code you have to scan, read and/or understand to troubleshoot problems or
tweak behaviours. This speed of development, the ease with which a programmer of other
languages can pick up basic Python skills and the huge standard library is key to another area
where Python excels. All its tools have been quick to implement, saved a lot of time, and
several of them have later been patched and updated by people with no Python background -
without breaking.

Install Python Step-by-Step in Windows and Mac

Python a versatile programming language doesn’t come pre-installed on your computer


devices. Python was first released in the year 1991 and until today it is a very popular high-
level programming language. Its style philosophy emphasizes code readability with its
notable use of great whitespace.

The object-oriented approach and language construct provided by Python enables


programmers to write both clear and logical code for projects. This software does not come
pre-packaged with Windows.

How to Install Python on Windows and Mac

There have been several updates in the Python version over the years. The question is how to
install Python? It might be confusing for the beginner who is willing to start learning Python
but this tutorial will solve your query. The latest or the newest version of Python is version
3.7.4 or in other words, it is Python 3.

Note: The python version 3.7.4 cannot be used on Windows XP or earlier devices.

Before you start with the installation process of Python. First, you need to know about
your System Requirements. Based on your system type i.e., operating system and based
processor, you must download the python version. My system type is a Windows 64-bit
operating system. So, the steps below are to install python version 3.7.4 on Windows 7
device or to install Python 3. Download the Python Cheatsheet here. The steps on how to
install Python on Windows 10, 8 and 7 are divided into 4 parts to help understand better.

Download the Correct version into the system

Step 1: Go to the official site to download and install python using Google Chrome or any
other web browser. OR Click on the following link: https://www.python.org

Now, check for the latest and the correct version for your operating system.

Step 2: Click on the Download Tab.


Step 3: You can either select the Download Python for windows 3.7.4 button in Yellow Color
or you can scroll further down and click on download with respective to their version. Here,
we are downloading the most recent python version for windows 3.7.4

Step 4: Scroll down the page until you find the Files option.

Step 5: Here you see a different version of python along with the operating system.
 To download Windows 32-bit python, you can select any one from the three options:
Windows x86 embeddable zip file, Windows x86 executable installer or Windows
x86 web-based installer.
 To download Windows 64-bit python, you can select any one from the three options:
Windows x86-64 embeddable zip file, Windows x86-64 executable installer or
Windows x86-64 web-based installer.
Here we will install Windows x86-64 web-based installer. Here your first part regarding
which version of python is to be downloaded is completed. Now we move ahead with the
second part in installing python i.e., Installation

Note: To know the changes or updates that are made in the version you can click on the
Release Note Option.

Installation of Python

Step 1: Go to Download and Open the downloaded python version to carry out the
installation process.
Step 2: Before you click on Install Now, Make sure to put a tick on Add Python 3.7 to PATH.

Step 3: Click on Install NOW After the installation is successful. Click on Close.
With these above three steps on python installation, you have successfully and correctly
installed Python. Now is the time to verify the installation.

Note: The installation process might take a couple of minutes.

Verify the Python Installation

Step 1: Click on Start

Step 2: In the Windows Run Command, type “cmd”.


Step 3: Open the Command prompt option.

Step 4: Let us test whether the python is correctly installed. Type python –V and press Enter.

Step 5: You will get the answer as 3.7.4

Note: If you have any of the earlier versions of Python already installed. You must first
uninstall the earlier version and then install the new one.

Check how the Python IDLE works

Step 1: Click on Start

Step 2: In the Windows Run command, type “python idle”.

Step 3: Click on IDLE (Python 3.7 64-bit) and launch the program

Step 4: To go ahead with working in IDLE you must first save the file. Click on File > Click
on Save
Step 5: Name the file and save as type should be Python files. Click on SAVE. Here I have
named the files as Hey World.

Step 6: Now for e.g. enter print (“Hey World”) and Press Enter.

You will see that the command given is launched. With this, we end our tutorial on how to
install Python. You have learned how to download python for windows into your respective
operating system.

Note: Unlike Java, Python does not need semicolons at the end of the statements otherwise it
won’t work.
Chapter 7

SYSTEM REQUIREMENTS SPECIFICATIONS


Software Requirements

The functional requirements or the overall description documents include the product
perspective and features, operating system and operating environment, graphics requirements,
design constraints and user documentation.

The appropriation of requirements and implementation constraints gives the general overview
of the project in regard to what the areas of strength and deficit are and how to tackle them.

 Python IDLE 3.7 version (or)


 Anaconda 3.7 (or)
 Jupiter (or)
 Google colab
Hardware Requirements

Minimum hardware requirements are very dependent on the particular software being
developed by a given Enthought Python / Canopy / VS Code user. Applications that need to
store large arrays/objects in memory will require more RAM, whereas applications that need
to perform numerous calculations or tasks more quickly will require a faster processor.

Operating system : Windows, Linux

Processor : minimum intel i3

Ram : minimum 4 GB

Hard disk : minimum 250GB


CHAPTER 8

FUNCTIONAL REQUIREMENTS
Output Design

Outputs from computer systems are required primarily to communicate the results of
processing to users. They are also used to provides a permanent copy of the results for later
consultation. The various types of outputs in general are:

 External Outputs, whose destination is outside the organization


 Internal Outputs whose destination is within organization and they are the
 User’s main interface with the computer.
 Operational outputs whose use is purely within the computer department.
 Interface outputs, which involve the user in communicating directly.
Output Definition

The outputs should be defined in terms of the following points:

 Type of the output


 Content of the output
 Format of the output
 Location of the output
 Frequency of the output
 Volume of the output
 Sequence of the output
It is not always desirable to print or display data as it is held on a computer. It should be
decided as which form of the output is the most suitable.

Input Design

Input design is a part of overall system design. The main objective during the input design is
as given below:

 To produce a cost-effective method of input.


 To achieve the highest possible level of accuracy.
 To ensure that the input is acceptable and understood by the user.
Input Stages

The main input stages can be listed as below:

 Data recording
 Data transcription
 Data conversion
 Data verification
 Data control
 Data transmission
 Data validation
 Data correction
Input Types

It is necessary to determine the various types of inputs. Inputs can be categorized as follows:

 External inputs, which are prime inputs for the system.


 Internal inputs, which are user communications with the system.
 Operational, which are computer department’s communications to the system?
 Interactive, which are inputs entered during a dialogue.
Input Media

At this stage choice has to be made about the input media. To conclude about the input
media consideration has to be given to;

 Type of input
 Flexibility of format
 Speed
 Accuracy
 Verification methods
 Rejection rates
 Ease of correction
 Storage and handling requirements
 Security
 Easy to use
 Portability
Keeping in view the above description of the input types and input media, it can be said that
most of the inputs are of the form of internal and interactive. As

Input data is to be the directly keyed in by the user, the keyboard can be considered to be the
most suitable input device.

Error Avoidance

At this stage care is to be taken to ensure that input data remains accurate form the stage at
which it is recorded up to the stage in which the data is accepted by the system. This can be
achieved only by means of careful control each time the data is handled.

Error Detection

Even though every effort is made to avoid the occurrence of errors, still a small proportion of
errors is always likely to occur, these types of errors can be discovered by using validations
to check the input data.

Data Validation

Procedures are designed to detect errors in data at a lower level of detail. Data validations
have been included in the system in almost every area where there is a possibility for the user
to commit errors. The system will not accept invalid data. Whenever an invalid data is
keyed in, the system immediately prompts the user and the user has to again key in the data
and the system will accept the data only if the data is correct. Validations have been included
where necessary.

The system is designed to be a user friendly one. In other words, the system has been
designed to communicate effectively with the user. The system has been designed with
popup menus.

User Interface Design

It is essential to consult the system users and discuss their needs while designing the user
interface:

User Interface Systems Can Be Broadly Classified As:

 User initiated interface the user is in charge, controlling the progress of the
user/computer dialogue. In the computer-initiated interface, the computer selects the
next stage in the interaction.
 Computer initiated interfaces
In the computer-initiated interfaces the computer guides the progress of the user/computer
dialogue. Information is displayed and the user response of the computer takes action or
displays further information.

User Initiated Interfaces

User initiated interfaces fall into two approximate classes:

 Command driven interfaces: In this type of interface the user inputs commands or
queries which are interpreted by the computer.
 Forms oriented interface: The user calls up an image of the form to his/her screen and
fills in the form. The forms-oriented interface is chosen because it is the best choice.
Computer-Initiated Interfaces

The following computer – initiated interfaces were used:

 The menu system for the user is presented with a list of alternatives and the user
chooses one; of alternatives.
 Questions – answer type dialog system where the computer asks question and takes
action based on the basis of the users reply.
Right from the start the system is going to be menu driven, the opening menu displays the
available options. Choosing one option gives another popup menu with more options. In this
way every option leads the users to data entry form where the user can key in the data.

Error Message Design

The design of error messages is an important part of the user interface design. As user is
bound to commit some errors or other while designing a system the system should be
designed to be helpful by providing the user with information regarding the error he/she has
committed.

This application must be able to produce output at different modules for different inputs.

Performance Requirements

Performance is measured in terms of the output provided by the application. Requirement


specification plays an important part in the analysis of a system. Only when the requirement
specifications are properly given, it is possible to design a system, which will fit into required
environment. It rests largely in the part of the users of the existing system to give the
requirement specifications because they are the people who finally use the system. This is
because the requirements have to be known during the initial stages so that the system can be
designed according to those requirements. It is very difficult to change the system once it has
been designed and on the other hand designing a system, which does not cater to the
requirements of the user, is of no use.

The requirement specification for any system can be broadly stated as given below:

 The system should be able to interface with the existing system


 The system should be accurate
 The system should be better than the existing system
 The existing system is completely dependent on the user to perform all the duties.
Chapter 9

RESULTS AND DISCUSSION


Dataset description

The MNIST dataset is one of the most well-known and widely used benchmark datasets in
the field of machine learning and computer vision. It stands for "Modified National Institute
of Standards and Technology" dataset. The MNIST dataset is commonly used as a starting
point for experimenting with and evaluating various algorithms, especially those related to
image classification and deep learning. It consists of a collection of grayscale images
representing handwritten digits along with their corresponding labels.

Here's a detailed description of the MNIST dataset:

Image Format:

 The dataset contains 70,000 images.


 Each image is a 28x28 pixel grayscale image, meaning it has a resolution of 28 pixels
by 28 pixels.
 Grayscale means that each pixel's intensity is represented by a single value indicating
the shade of gray, ranging from 0 (black) to 255 (white).

Labels:

 Each image in the dataset is associated with a label that represents the digit it depicts
(0 to 9).

Dataset Composition:

The dataset is typically divided into a training set and a testing set.

 The training set contains 60,000 images and their corresponding labels.
 The testing set contains 10,000 images and their labels.

Availability:

 The MNIST dataset is freely available online and can be accessed through various
machine learning libraries, such as TensorFlow and PyTorch.
Figure 1 shows a line plot where the x-axis represents the number of training rounds, and the
y-axis represents both the user model's accuracy and error. The graph shows how the
accuracy and error of the user model change as the training progresses. This figure provides
insights into how well the FedAvg-Adam algorithm performs in terms of accuracy and error
during training.

Figure 1: Plotting results of user model accuracy and error vs number of rounds obtained
using FedAvg-Adam Algorithm for train dataset.
Figure 2: Plotting results of user model accuracy and error vs number of rounds obtained
using FedAvg-Adam Algorithm for test dataset.

Figure 2 provides a demonstration of the number of test rounds or iterations, and both user
model accuracy and error. This figure demonstrates how the user model's accuracy and error
evolve during testing using the FedAvg-Adam algorithm. Likewise, Figure 3 presents a plot,
with the x-axis indicating training rounds and the y-axis representing both user model
accuracy and error. The focus here is on the FedAvg algorithm's performance during training
using the training dataset. It helps assess how accurately the FedAvg algorithm converges and
minimizes error during training. In Figure 4, the graph provides an overview of how the user
model's accuracy improves with more test rounds while utilizing the FedAvg algorithm. This
figure aids in understanding the algorithm's ability to improve accuracy over time. Figure 5
illustrates how the error of the user model decreases as the number of test rounds increases
when applying the FedAvg algorithm. This helps in gauging the algorithm's effectiveness in
reducing errors during testing.

Figure 3: Plotting results of user model accuracy and error vs number of rounds obtained
using FedAvg Algorithm for train dataset.

Figure 6 showcases a line plot where the x-axis indicates training rounds, and the y-axis
shows both user model accuracy and error. The graph captures how user model accuracy and
error change over successive rounds of training using the FedAdam algorithm. It allows
assessing the FedAdam algorithm's impact on accuracy and error during training. Figure 7
provides insights into how the user model's accuracy and error evolve during testing with the
FedAdam algorithm. This information is valuable for assessing the algorithm's performance
in unseen data scenarios. Finally, this analysis can contribute to optimizing federated learning
algorithms for improved performance in decentralized computing settings.

Figure 4: Plotting results of user model accuracy vs number of rounds obtained using FedAvg
Algorithm for test dataset.

Figure 5: Plotting results of user model error vs number of rounds obtained using FedAvg
Algorithm for test dataset.
Figure 6: Plotting results of user model accuracy and error vs number of rounds obtained
using FedAdam Algorithm for train dataset.

Figure 7: Plotting results of user model accuracy and error vs number of rounds obtained
using FedAdam Algorithm for test dataset.

Table 1 presents a comprehensive assessment of the performance of various optimization


strategies applied to federated learning algorithms. The table primarily focuses on the number
of rounds necessary for these algorithms to attain a significant milestone of 95% user model
accuracy. This accuracy level indicates how effectively the algorithms predict desired
outcomes and holds substantial importance in evaluating their efficiency and convergence
rate.
In the "Algorithm" column, the three federated learning algorithms under examination are
listed: "FedAvg," "FedAdam," and "FedAvg-Adam." These algorithms have been subjected to
rigorous evaluation to understand their behaviour in real-world scenarios, specifically in the
context of edge and fog computing environments. The subsequent columns, titled "Number
of Rounds Taken to Obtain 95% User Model Accuracy," provide valuable insights into the
convergence characteristics of each algorithm. This metric is calculated both for the training
and test datasets, offering a holistic view of the algorithms' performance across different
scenarios.

Focusing on the "Train" sub-column, it becomes evident that each algorithm exhibits distinct
convergence behaviours during the training phase. For the "FedAvg" algorithm, achieving
95% user model accuracy necessitated 107 rounds. On the other hand, the "FedAdam"
algorithm required a higher number of rounds, specifically 194, to attain the same accuracy
level. The "FedAvg-Adam" algorithm displayed notable efficiency, requiring only 67 rounds
to reach the desired accuracy during training. Moving to the "Test" sub-column, which
assesses the algorithms' generalization capabilities, similar trends are observed. The
"FedAvg" algorithm achieved 95% user model accuracy on the test dataset after 81 rounds.
Comparatively, the "FedAdam" algorithm exhibited a slightly higher convergence rate,
necessitating 103 rounds for the same accuracy level. Notably, the "FedAvg-Adam" algorithm
demonstrated superior convergence speed on the test dataset, achieving the desired accuracy
in just 60 rounds.

Table 1. Performance evaluation of proposed optimization of federated learning algorithms.

Number of rounds taken to obtain 95% user model accuracy


Algorithm Train Test
FedAvg 107 81
FedAdam 194 103
FedAvg-Adam 67 60

In essence, Table 1 encapsulates the essence of the performance evaluation conducted on


these federated learning algorithms. It offers insights into the algorithms' convergence
behaviours and efficiency when striving for a user model accuracy of 95%. These findings
provide valuable information for researchers, developers, and practitioners aiming to
optimize federated learning algorithms for improved performance and effectiveness,
particularly within the context of edge and fog computing scenarios.

Chapter 10

Conclusion And Future Scope

Conclusion

In conclusion, this study addresses the pressing challenges of training Deep Neural Networks
(DNNs) in the context of Multi-access Edge Computing (MEC) while preserving user privacy
and improving model accuracy. By introducing non-federated Batch-Normalization (BN)
layers into the Federated Learning (FL) framework, the proposed algorithm allows users to
train personalized models without sharing sensitive data, benefiting both User Model
Accuracy (UA) and convergence speed. The incorporation of distributed Adam optimization
(FedAvg-Adam) further enhances the convergence speed of FL algorithms, making them
more suitable for edge computing scenarios. Empirical evaluations of FedAvg, FedAdam,
and FedAvg-Adam demonstrate their potential to enhance model accuracy, reduce
communication overhead, and decrease energy consumption, rendering them practical and
scalable for real-world edge applications.

Future Scope

Looking to the future, there are several exciting avenues for research and development in this
domain. Firstly, continued refinement of FL algorithms to handle non-Independent and
Identically Distributed (non-IID) user data will be crucial, as the heterogeneity of edge
devices and user-generated data is likely to persist. Additionally, exploring the integration of
FL with other privacy-preserving techniques, such as homomorphic encryption or secure
multi-party computation, could further bolster user data privacy in edge computing
environments. Furthermore, optimizing FL algorithms for specific edge applications, such as
autonomous vehicles, smart cities, or healthcare, will be essential to harness the full.
References

[1].Deng, S.; Zhao, H.; Fang, W.; Yin, J.; Dustdar, S.; Zomaya, A.Y. Edge intelligence:
The confluence of edge computing and artificial intelligence. IEEE Internet Things J.
2020, 7, 7457–7469.
[2].Shafique, K.; Khawaja, B.A.; Sabir, F.; Qazi, S.; Mustaqim, M. Internet of things
(IoT) for next-generation smart systems: A review of current challenges, future trends
and prospects for emerging 5G-IoT scenarios. IEEE Access 2020, 8, 23022–23040.
[3].Khan, L.U.; Saad, W.; Han, Z.; Hossain, E.; Hong, C.S. Federated learning for
internet of things: Recent advances, taxonomy, and open challenges. IEEE Commun.
Surv. Tutor. 2021, 23, 1759–1799.
[4].Niknam, S.; Dhillon, H.S.; Reed, J.H. Federated learning for wireless
communications: Motivation, opportunities, and challenges. IEEE Commun. Mag.
2020, 58, 46–51.
[5].Wang, X.; Ning, Z.; Guo, L.; Guo, S.; Gao, X.; Wang, G. Mean-Field Learning for
Edge Computing in Mobile Blockchain Networks. IEEE Trans. Mob. Comput. 2022,
1–17.
[6].Zhu, Z.; Hong, J.; Zhou, J. Data-free knowledge distillation for heterogeneous
federated learning. In Proceedings of the International Conference on Machine
Learning, PMLR, Virtual, 18–24 July 2021; pp. 12878–12889.
[7].Ning, Z.; Zhang, K.; Wang, X.; Guo, L.; Hu, X.; Huang, J.; Hu, B.; Kwok, R.Y.K.
Intelligent Edge Computing in Internet of Vehicles: A Joint Computation Offloading
and Caching Solution. IEEE Trans. Intell. Transp. Syst. 2021, 22, 2212–2225.
[8].Wang, J.; Zhang, H.; Wang, J.; Pu, Y.; Pal, N.R. Feature Selection Using a Neural
Network With Group Lasso Regularization and Controlled Redundancy. IEEE Trans.
Neural Netw. Learn. Syst. 2021, 32, 1110–1123.
[9].Zhang, H.; Wang, J.; Sun, Z.; Zurada, J.M.; Pal, N.R. Feature Selection for Neural
Networks Using Group Lasso Regularization. IEEE Trans. Knowl. Data Eng. 2020,
32, 659–673.
[10]. Zhou, X.; Liang, W.; She, J.; Yan, Z.; Kevin, I.; Wang, K. Two-layer federated
learning with heterogeneous model aggregation for 6g supported internet of vehicles.
IEEE Trans. Veh. Technol. 2021, 70, 5308–5317.
[11]. Xue, G.; Chang, Q.; Wang, J.; Zhang, K.; Pal, N.R. An Adaptive Neuro-Fuzzy
System With Integrated Feature Selection and Rule Extraction for High-Dimensional
Classification Problems. IEEE Trans. Fuzzy Syst. 2022, 1–15.
[12]. Zhang, P.; Sun, H.; Situ, J.; Jiang, C.; Xie, D. Federated transfer learning for
IIoT devices with low computing power based on blockchain and edge computing.
IEEE Access 2021, 9, 98630–98638.
[13]. Li, T.; Sahu, A.K.; Talwalkar, A.; Smith, V. Federated learning: Challenges,
methods, and future directions. IEEE Signal Process. Mag. 2020, 37, 50–60.
[14]. Ning, Z.; Zhang, K.; Wang, X.; Obaidat, M.S.; Guo, L.; Hu, X.; Hu, B.; Guo,
Y.; Sadoun, B.; Kwok, R.Y.K. Joint Computing and Caching in 5G-Envisioned
Internet of Vehicles: A Deep Reinforcement Learning-Based Traffic Control System.
IEEE Trans. Intell. Transp. Syst. 2021, 22, 5201–5212.
[15]. Konečnỳ, J.; McMahan, H.B.; Yu, F.X.; Richtárik, P.; Suresh, A.T.; Bacon, D.
Federated learning: Strategies for improving communication efficiency. arXiv 2016,
arXiv:1610.05492.
[16]. Sattler, F.; Wiedemann, S.; Müller, K.R.; Samek, W. Robust and
communication-efficient federated learning from non-iid data. IEEE Trans. Neural
Netw. Learn. Syst. 2019, 31, 3400–3413. [PubMed]
[17]. Mills, J.; Hu, J.; Min, G. User-Oriented Multi-Task Federated Deep Learning
for Mobile Edge Computing. arXiv 2020, arXiv:2007.09236.
[18]. Guo, H.; Liu, A.; Lau, V.K. Analog gradient aggregation for federated learning
over wireless networks: Customized design and convergence analysis. IEEE Internet
Things J. 2020, 8, 197–210.
[19]. Wu, Y.; Wang, Z.; Zeng, D.; Shi, Y.; Hu, J. Enabling on-device self-supervised
contrastive learning with selective data contrast. In Proceedings of the 2021 58th
ACM/IEEE Design Automation Conference (DAC), San Francisco, CA, USA, 5–9
December 2021; pp. 655–660.
[20]. Sonmez, C.; Ozgovde, A.; Ersoy, C. Edgecloudsim: An environment for
performance evaluation of edge computing systems. Trans. Emerg. Telecommun.
Technol. 2018, 29, e3493.
[21]. Hu, Y.C.; Patel, M.; Sabella, D.; Sprecher, N.; Young, V. Mobile edge
computing—A key technology towards 5G. ETSI White Pap. 2015, 11, 1–16. [Google
Scholar]
[22]. Ning, Z.; Sun, S.; Wang, X.; Guo, L.; Guo, S.; Hu, X.; Hu, B.; Kwok, R.Y.K.
Blockchain-Enabled Intelligent Transportation Systems: A Distributed Crowdsensing
Framework. IEEE Trans. Mob. Comput. 2022, 21, 4201–4217.
[23]. Mao, Y.; You, C.; Zhang, J.; Huang, K.; Letaief, K.B. A survey on mobile edge
computing: The communication perspective. IEEE Commun. Surv. Tutor. 2017, 19,
2322–2358.
[24]. Shi, W.; Zhou, S.; Niu, Z.; Jiang, M.; Geng, L. Joint device scheduling and
resource allocation for latency constrained wireless federated learning. IEEE Trans.
Wirel. Commun. 2020, 20, 453–467.
[25]. Liu, Y.; Yuan, X.; Xiong, Z.; Kang, J.; Wang, X.; Niyato, D. Federated
learning for 6G communications: Challenges, methods, and future directions. China
Commun. 2020, 17, 105–118.
[26]. Zhang, P.; Zhang, Y.; Kumar, N.; Guizani, M. Dynamic SFC Embedding
Algorithm Assisted by Federated Learning in Space–Air–Ground-Integrated Network
Resource Allocation Scenario. IEEE Internet Things J. 2023, 10, 9308–9318.
[27]. Luo, S.; Chen, X.; Wu, Q.; Zhou, Z.; Yu, S. HFEL: Joint edge association and
resource allocation for cost-efficient hierarchical federated edge learning. IEEE Trans.
Wirel. Commun. 2020, 19, 6535–6548.
[28]. Hosseinalipour, S.; Brinton, C.G.; Aggarwal, V.; Dai, H.; Chiang, M. From
federated to fog learning: Distributed machine learning over heterogeneous wireless
networks. IEEE Commun. Mag. 2020, 58, 41–47.
[29]. Xue, Z.; Zhou, P.; Xu, Z.; Wang, X.; Xie, Y.; Ding, X.; Wen, S. A resource-
constrained and privacy-preserving edge-computing-enabled clinical decision system:
A federated reinforcement learning approach. IEEE Internet Things J. 2021, 8, 9122–
9138.
[30]. Bowo, W.A.; Suhanto, A.; Naisuty, M.; Ma’mun, S.; Hidayanto, A.N.;
Habsari, I.C. Data Quality Assessment: A Case Study of PT JAS Using TDQM
Framework. In Proceedings of the 2019 Fourth International Conference on
Informatics and Computing (ICIC), Semarang, Indonesia, 16–17 October 2019; pp. 1–
6.
APPENDIX
import pandas as pd

import pickle

import numpy as np

import matplotlib.pyplot as plt

#Load the experimented data from Pickle file

my_data = pd.read_pickle('dset-mnist_alg-fedavg-adam_C-0.5_B-20_T-400_E-1_device-
cpu_W-200_seed-2_lr-0.5_noisy_frac-0.2_bn_private-usyb_beta1-0.5_beta2-0.5_epsilon-
0.5.pkl')

#print(my_data)

train_err = my_data[0]

train_acc = my_data[1]

test_err = my_data[2]

test_acc = my_data[3]

#Plot the results of FedAvg-Adam Algorithm

r = range(0,400)

plt.plot(r,train_acc,r,train_err)
plt.xlabel('Number of Rounds')

plt.ylabel('User model accuracy and error')

plt.legend(['accuracy','error'])

plt.title('FedAvg-Adam Algorithm with Training')

plt.show()

#Plot the results of FedAvg-Adam Algorithm

plt.plot(r,test_acc,r,test_err)

plt.xlabel('Number of Rounds')

plt.ylabel('User model accuracy and error')

plt.title('FedAvg-Adam Algorithm with Test data')

plt.show()

train = []

test = []

#function to calculate different metrics

def roundsTaken(algorithm, train_acc, test_acc):

for i in range(400):

if train_acc[i]>=0.956:

min_train_rounds=i

break
for i in range(400):

if test_acc[i]>=0.956:

min_test_rounds=i

break

print(algorithm+" Rounds taken to obtain 95% user model accuracy (train data) :
"+str(min_train_rounds))

print(algorithm+" Rounds taken to obtain 95% user model accuracy (test data) :
"+str(min_test_rounds))

train.append(min_train_rounds)

test.append(min_test_rounds)

roundsTaken("FedAvg-Adam", train_acc, test_acc)

#%run main.py -dset mnist -C 0.5 -W 200 -T 400 -E 1 -alg fedavg -seed 2 -lr 0.5 -noisy_frac
0.2 -device cpu -B 20 -bn_private usyb

# Load the experiment data from Pickle file

my_data=pd.read_pickle('dset-mnist_alg-fedavg_C-0.5_B-20_T-400_E-1_device-cpu_W-
200_seed-2_lr-0.5_noisy_frac-0.2_bn_private-usyb.pkl')

#print(my_data)

train_err = my_data[0]

train_acc = my_data[1]

test_err = my_data[2]
test_acc = my_data[3]

#Plot the results of FedAvg Algorithm

r = range(0,400)

plt.plot(r,train_acc,r,train_err)

plt.xlabel('Number of Rounds')

plt.ylabel('User model accuracy and error')

plt.legend(['Accuracy','Error'])

plt.title('FedAvg Algorithm with Train data')

plt.show()

#Plot the results of FedAvg Algorithm

plt.plot(r,test_acc)

plt.xlabel('Number of rounds')

plt.ylabel('User model accuracy')

plt.title('FedAvg Algorithm with Test data')

plt.show()

#Plot the results of FedAvg Algorithm

plt.plot(r,test_err)

plt.xlabel('Number of rounds')

plt.ylabel('Test error %')

plt.title('FedAvg Algorithm with Test data')

plt.show()
roundsTaken("FedAvg", train_acc, test_acc)

#%run main.py -dset mnist -C 0.5 -W 200 -T 400 -E 1 -alg fedadam -seed 2 -lr 0.5 -server_lr
0.2 -noisy_frac 0.2 -device cpu -B 20 -bn_private usyb -beta1 0.5 -beta2 0.5 -epsilon 0.5

# Load the experimented data from Pickle file

my_data = pd.read_pickle('dset-mnist_alg-fedadam_C-0.5_B-20_T-400_E-1_device-cpu_W-
200_seed-2_lr-0.5_noisy_frac-0.2_bn_private-usyb_server_lr-0.2_beta1-0.5_beta2-
0.5_epsilon-0.5.pkl')

#print(my_data)

train_err = my_data[0]

train_acc = my_data[1]

test_err = my_data[2]

test_acc = my_data[3]

# Plot the reuslts of FedAdam Algorithm

r = range(0,400)

plt.plot(r,train_acc,r,train_err)

plt.xlabel('Number of Rounds')

plt.ylabel('User model accuracy and error')

plt.legend(['Accuracy','Error'])

plt.title('FedAdam Algorithm with Train data')

plt.show()
# Plot the reuslts of FedAdam Algorithm

plt.plot(r,test_acc,r,test_err)

plt.xlabel('Number of Rounds')

plt.ylabel('User model accuracy and error')

plt.legend(['Accuracy','Error'])

plt.title('FedAdam Algorithm with Test data')

plt.show()

#%run main.py -dset mnist -C 0.5 -W 200 -T 400 -E 1 -alg fedavg-adam -seed 2 -lr 0.5 -
noisy_frac 0.2 -device cpu -B 20 -bn_private none -beta1 0.9 -beta2 0.9 -epsilon 0.5

roundsTaken("FedAdam", train_acc, test_acc)

columns = ["Algorithm Name","Train Data","Test Data"]

values = []

algorithm_names = ["FedAvg-Adam","FedAvg","FedAdam"]

for i in range(len(algorithm_names)):

values.append([algorithm_names[i],train[i],test[i]])

temp = pd.DataFrame(values,columns=columns)

display(temp)

You might also like