pdfcoffee
Chapter 13keras_model = …keras_model.compile(...)keras_federated_model = tff.learning.from_compiled_keras_model(keras_model, ..)2. Builders: This is the layer where the federated computation happens. Thereare two phases: compilation, where the learning algorithm is serialized intoan abstract representation of the computation, and execution, where therepresented computation is run.3. Datasets: This is a large collection of data that can be used to simulatefederated learning locally – a step useful for the initial fine tuning.We conclude this overview by mentioning that you can find a detailed description(https://www.tensorflow.org/federated/federated_learning) of APIsonline, and also a number of coding examples. The suggestion is to start by usingthe Colab notebook made available by Google (https://colab.research.google.com/github/tensorflow/federated/blob/v0.10.1/docs/tutorials/federated_learning_for_image_classification.ipynb). The framework allowsus to simulate the distributed training before running it on a real environment. Thelibrary in charge of FL learning is tensorflow_federated. Figure 12 discussed allthe steps used in federated learning with multiple nodes, and it might be usefulto better understand what has been discussed in this section. The next sectionwill introduce TensorFlow.js, a variant of TensorFlow that can be used natively inJavaScript:Figure 12: An example of federated learning with multiple nodes (source: https://upload.wikimedia.org/wikipedia/commons/e/e2/Federated_learning_process_central_case.png)[ 477 ]
TensorFlow for Mobile and IoT and TensorFlow.jsTensorFlow.jsTensorFlow.js is a JavaScript library for machine learning models that can workeither in vanilla mode or via Node.js. In this section we are going to review bothof them.Vanilla TensorFlow.jsTensorFlow.js is a JavaScript library for training and using Machine Learning (ML)models in a browser. It is derived from deeplearn.js, an open source, hardwareacceleratedlibrary for doing Deep Learning (DL) in JavaScript, and is now acompanion library to TensorFlow.The most common use of TensorFlow.js is to make pretrained ML/DL modelsavailable on the browser. This can help in situations where it may not be feasible tosend client data back to the server due to network bandwidth or security concerns.However, TensorFlow.js is a full stack ML platform, and it is possible to build andtrain an ML/DL model from scratch, as well as fine-tune an existing pretrainedmodel with new client data.An example of a TensorFlow.js application is the TensorFlow Projector (https://projector.tensorflow.org), which allows a client to visualize their own data (asword vectors) in 3-dimensional space, using one of several dimensionality reductionalgorithms provided. There are a few other examples of TensorFlow.js applicationslisted on the TensorFlow.js demo page (https://www.tensorflow.org/js/demos).Similarly to TensorFlow, TensorFlow.js also provides two main APIs – the OpsAPI, which exposes low-level tensor operations such as matrix multiplication, andthe Layers API, which exposes Keras-style high-level building blocks for neuralnetworks.At the time of writing, TensorFlow.js runs on three different backends. The fastest(and also the most complex) is the WebGL backend, which provides access toWebGL's low-level 3D graphics APIs and can take advantage of GPU hardwareacceleration. The other popular backend is the Node.js backend, which allows theuse of TensorFlow.js in server-side applications. Finally, as a fallback, there is theCPU-based implementation in plain JavaScript that will run in any browser.In order to gain a better understanding of how to write a TensorFlow.jsapplication, we will walk through an example of classifying MNIST digits usinga Convolutional Neural Network (CNN) provided by the TensorFlow.js team(https://storage.googleapis.com/tfjs-examples/mnist/dist/index.html).[ 478 ]
- Page 462 and 463: Chapter 11DQN to play a game of Ata
- Page 464 and 465: Chapter 11self.model.add( Conv2D(64
- Page 466 and 467: Chapter 11Here the action A was sel
- Page 468 and 469: Chapter 11Image source: https://arx
- Page 470 and 471: Chapter 11A neural network is used
- Page 472: Chapter 1111. Details regarding ins
- Page 475 and 476: TensorFlow and Cloud• Scalability
- Page 477 and 478: TensorFlow and Cloud• Azure DevOp
- Page 479 and 480: TensorFlow and Cloud• Lambda: The
- Page 481 and 482: TensorFlow and Cloud• Deep Learni
- Page 483 and 484: TensorFlow and CloudEC2 on AmazonTo
- Page 485 and 486: TensorFlow and CloudCompute Instanc
- Page 487 and 488: TensorFlow and CloudYou just share
- Page 489 and 490: TensorFlow and CloudIn case you req
- Page 491 and 492: TensorFlow and CloudIt starts with
- Page 493 and 494: TensorFlow and CloudTFX librariesTF
- Page 495 and 496: TensorFlow and CloudReferences1. To
- Page 497 and 498: TensorFlow for Mobile and IoT and T
- Page 499 and 500: TensorFlow for Mobile and IoT and T
- Page 501 and 502: TensorFlow for Mobile and IoT and T
- Page 503 and 504: TensorFlow for Mobile and IoT and T
- Page 505 and 506: TensorFlow for Mobile and IoT and T
- Page 507 and 508: TensorFlow for Mobile and IoT and T
- Page 509 and 510: TensorFlow for Mobile and IoT and T
- Page 511: TensorFlow for Mobile and IoT and T
- Page 515 and 516: TensorFlow for Mobile and IoT and T
- Page 517 and 518: TensorFlow for Mobile and IoT and T
- Page 519 and 520: TensorFlow for Mobile and IoT and T
- Page 521 and 522: TensorFlow for Mobile and IoT and T
- Page 523 and 524: TensorFlow for Mobile and IoT and T
- Page 525 and 526: TensorFlow for Mobile and IoT and T
- Page 527 and 528: An introduction to AutoMLThat is pr
- Page 529 and 530: An introduction to AutoMLFeature co
- Page 531 and 532: An introduction to AutoMLThis Effic
- Page 533 and 534: An introduction to AutoMLGoogle Clo
- Page 535 and 536: An introduction to AutoMLThen, we c
- Page 537 and 538: An introduction to AutoMLOnce the d
- Page 539 and 540: An introduction to AutoMLIf your mo
- Page 541 and 542: An introduction to AutoMLClicking o
- Page 543 and 544: An introduction to AutoMLFigure 16:
- Page 545 and 546: An introduction to AutoMLYou can al
- Page 547 and 548: An introduction to AutoMLPut simply
- Page 549 and 550: An introduction to AutoMLLet's star
- Page 551 and 552: An introduction to AutoMLThe token
- Page 553 and 554: An introduction to AutoMLThis will
- Page 555 and 556: An introduction to AutoMLFigure 37:
- Page 557 and 558: An introduction to AutoMLAt the end
- Page 559 and 560: An introduction to AutoMLUsing Clou
- Page 561 and 562: An introduction to AutoMLOnce the d
Chapter 13
keras_model = …
keras_model.compile(...)
keras_federated_model = tff.learning.from_compiled_keras_
model(keras_model, ..)
2. Builders: This is the layer where the federated computation happens. There
are two phases: compilation, where the learning algorithm is serialized into
an abstract representation of the computation, and execution, where the
represented computation is run.
3. Datasets: This is a large collection of data that can be used to simulate
federated learning locally – a step useful for the initial fine tuning.
We conclude this overview by mentioning that you can find a detailed description
(https://www.tensorflow.org/federated/federated_learning) of APIs
online, and also a number of coding examples. The suggestion is to start by using
the Colab notebook made available by Google (https://colab.research.
google.com/github/tensorflow/federated/blob/v0.10.1/docs/tutorials/
federated_learning_for_image_classification.ipynb). The framework allows
us to simulate the distributed training before running it on a real environment. The
library in charge of FL learning is tensorflow_federated. Figure 12 discussed all
the steps used in federated learning with multiple nodes, and it might be useful
to better understand what has been discussed in this section. The next section
will introduce TensorFlow.js, a variant of TensorFlow that can be used natively in
JavaScript:
Figure 12: An example of federated learning with multiple nodes (source: https://upload.wikimedia.org/
wikipedia/commons/e/e2/Federated_learning_process_central_case.png)
[ 477 ]