TensorFlow Federated (TFF) is an open-source framework for machine learning and other computations on decentralized data.
Federated Learning (FL) API This layer offers a set of high-level interfaces that allow developers to apply the included implementations of federated training and evaluation to their existing TensorFlow models.该层提供了一组高级接口,允许开发人员将所包含的联合训练和评估实现应用于现有的TensorFlow模型
Federated Core (FC) API At the core of the system is a set of lower-level interfaces for concisely expressing novel federated algorithms by combining TensorFlow with distributed communication operators within a strongly-typed functional programming environment. This layer also serves as the foundation upon which we've built Federated Learning.该系统的核心是一组低级接口,用于通过在强类型函数编程环境中结合TensorFlow 和分布式通信操作符来简洁地表达新的联合算法。这一层也是我们建立联合学习的基础。
tff.learning
tf.data.Dataset
,因此可以使用数据集转换完成预处理。tff.learning.Model
重新包装下tff.utils.IterativeProcess
,其中这些计算可作为一对初始化和下一个属性使用。initialize
计算来构造服务器状态next
表示单轮联合平均(Federated Averaging),其包括将服务器状态(包括模型参数)推送到客户端,对其本地数据进行设备上训练,收集和平均模型更新,并在服务器上生成新的更新模型。可以类比成以下过程next()
不仅是一个在server上运行的函数,而是作为整个分布式计算的声明性函数表示,某些输入由server(SERVER_STATE)提供,但每个参与的设备都提供其自己的本地数据集。namedtuple
用于保存训练指标aggregate_mnist_metrics_across_clients
聚合本地指标数据的方法metrics
是上一个方法get_local_mnist_metrics
返回的,但值已不再是tf.Tensors
类型,而是经过Boxed
成为了tff.Value
,改变量不能再使用TensorFlow来修改,只能用TFF的联合操作例如:tff.federated_mean
和tff.federated_sum
tf.functions
,因为这有助于确保TensorFlow可以序列化,并且不需要显式的控制依赖tff.learning.build_federated_evaluation
,传入模型构造函数MnistModel
已足够,不像联合平均那样需要传入一个可训练的模型MnistTrainableModel
tf.keras.models.Model.evaluate()
来进行评估。.model
成员