Federated Learning is a fascinating and upsurging Machine Learning technique for learning on decentralized data. The core idea is that a training dataset can remain in the hands of its producers (also known as workers), which helps improve privacy and ownership while the model is shared between workers.
In this tutorial, we will give an overview of federated learning, definitions, and implementation.
Summary: Simple code examples make learning easy. Here, we use the MNIST training task to introduce Federated Learning the easy way.
Prerequisites
Install required dependencies
- ubuntu
- macOS
- windows
- centos7
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"$ export PATH="/usr/local/bin:/usr/local/sbin:$PATH"$ brew update$ brew install python # Python 3$ sudo pip3 install --user --upgrade virtualenvInstall Tensorflow
Let's implement a federated learning algorithm in Python with
Tensorflow
:$ virtualenv --python python3 "venv"$ source "venv/bin/activate"$ pip install --upgrade pip$ pip install tensorflow$ pip install --upgrade tensorflow-federated
Once the prerequisites are installed, you can start to build your AI Network.
Compiling AI Network
Firstly, you need to compile the source code.
Clone the source code
git clone https://github.com/aioz-ai/LDR_ALDK.gitCompile the source code
cd LDR_ALDKpip install -r requirements.txt
Next Step
You have got the basis of federated learning, let's keep moving.
Your next step may be:
- Develop your first federated learning algorithm.
- Deploy your application.
If you experienced any issues with this tutorial or want to provide feedback, feel free to open a GitHub issue or reach out on Slack.