Knowledge Graph — Coursera NotesAcademic disciplinesInformation Technology / Computer ScienceMachine LearningFederated Learning

TensorFlow Federated

service · part of Federated Learning

Federated learning can be implemented using frameworks such as TensorFlow Federated and PyTorch. A typical code example for federated averaging in TensorFlow Federated is:

import tensorflow_federated as tff

def create_keras_model():
    return tf.keras.models.Sequential([
        tf.keras.layers.Dense(10, activation=tf.nn.relu, input_shape=(784,)),
        tf.keras.layers.Dense(10, activation=tf.nn.softmax)
    ])

def model_fn():
    keras_model = create_keras_model()
    return tff.learning.from_keras_model(
        keras_model,
        input_spec=train_data[0].element_spec,
        loss=tf.keras.losses.SparseCategoricalCrossentropy(),
        metrics=[tf.keras.metrics.SparseCategoricalAccuracy()]
    )

iterative_process = tff.learning.build_federated_averaging_process(model_fn)
state = iterative_process.initialize()
for round in range(num_rounds):
    state, metrics = iterative_process.next(state, train_data)

This is the text view of an interactive 3D knowledge graph — open this page with JavaScript enabled to explore it visually.

🧠 Knowledge Graph

Select a node

The owner's editing tools — shown here so you can see how the graph is grown, but read-only.

Click a bubble to drill in · click again to collapse · drag to move around