November 2019
Intermediate to advanced
346 pages
9h 36m
English
In the following steps, you will create two virtual dataset environments—one belonging to Alice, and one belonging to Bob—and use federated averaging to preserve data confidentiality.
import tensorflow as tftf.compat.v1.enable_v2_behavior()
import tensorflow_datasets as tfdsfirst_50_percent = tfds.Split.TRAIN.subsplit(tfds.percent[:50])last_50_percent = tfds.Split.TRAIN.subsplit(tfds.percent[-50:])alice_dataset = tfds.load("fashion_mnist", split=first_50_percent)bob_dataset = tfds.load("fashion_mnist", split=last_50_percent)