This week


Here we are, we are finally starting with the actual Federated Learning!

TensorFlow Federated

So, to start, because Tensorflow has provided some **useful tutorials** I will follow them to learn how TFF works.

The first tutorial I will follow is about classifying the famous MNIST dataset using FL:

Google Colaboratory

As we follow the tutorial, I will add concepts and information also to this page which is dedicated to the TFF framework:


As in the tutorial, we will work on Google Colab to make everything easier:

Google Colaboratory

To start, we need to install the TFF packages:

#@test {"skip": true}
!pip install --quiet --upgrade tensorflow_federated

%load_ext tensorboard

Now we can import all the usual required libraires:

import collections

import numpy as np
import tensorflow as tf

tf.compat.v1.enable_v2_behavior()
import tensorflow_federated as tff
from tensorflow import feature_column

import pandas as pd
from tqdm import tqdm
import os

np.random.seed(0)

To test if TFF is correctly set, we can call a federated computation:

# Test FTT
tff.federated_computation(lambda: 'Lets start with FL!')()

# Output
b'Lets start with FL!'