Hands-On Machine Learning with TensorFlow.js
eBook - ePub

Hands-On Machine Learning with TensorFlow.js

A guide to building ML applications integrated with web technology using the TensorFlow.js library

Kai Sasaki

  1. 296 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Hands-On Machine Learning with TensorFlow.js

A guide to building ML applications integrated with web technology using the TensorFlow.js library

Kai Sasaki

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Get hands-on with the browser-based JavaScript library for training and deploying machine learning models effectively

Key Features

  • Build, train and run machine learning models in the browser using TensorFlow.js
  • Create smart web applications from scratch with the help of useful examples
  • Use flexible and intuitive APIs from TensorFlow.js to understand how machine learning algorithms function

Book Description

TensorFlow.js is a framework that enables you to create performant machine learning (ML) applications that run smoothly in a web browser. With this book, you will learn how to use TensorFlow.js to implement various ML models through an example-based approach.

Starting with the basics, you'll understand how ML models can be built on the web. Moving on, you will get to grips with the TensorFlow.js ecosystem to develop applications more efficiently. The book will then guide you through implementing ML techniques and algorithms such as regression, clustering, fast Fourier transform (FFT), and dimensionality reduction. You will later cover the Bellman equation to solve Markov decision process (MDP) problems and understand how it is related to reinforcement learning. Finally, you will explore techniques for deploying ML-based web applications and training models with TensorFlow Core. Throughout this ML book, you'll discover useful tips and tricks that will build on your knowledge.

By the end of this book, you will be equipped with the skills you need to create your own web-based ML applications and fine-tune models to achieve high performance.

What you will learn

  • Use the t-SNE algorithm in TensorFlow.js to reduce dimensions in an input dataset
  • Deploy tfjs-converter to convert Keras models and load them into TensorFlow.js
  • Apply the Bellman equation to solve MDP problems
  • Use the k-means algorithm in TensorFlow.js to visualize prediction results
  • Create tf.js packages with Parcel, Webpack, and Rollup to deploy web apps
  • Implement tf.js backend frameworks to tune and accelerate app performance

Who this book is for

This book is for web developers who want to learn how to integrate machine learning techniques with web-based applications from scratch. This book will also appeal to data scientists, machine learning practitioners, and deep learning enthusiasts who are looking to perform accelerated, browser-based machine learning on Web using TensorFlow.js. Working knowledge of JavaScript programming language is all you need to get started.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Hands-On Machine Learning with TensorFlow.js als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Hands-On Machine Learning with TensorFlow.js von Kai Sasaki im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Web Development. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2019
ISBN
9781838827878

Section 1: The Rationale of Machine Learning and the Usage of TensorFlow.js

In this section, readers will explore how machine learning applications work on the web platform. They will also learn how to set up an environment to run TensorFlow.js. Furthermore, readers will learn how to import pretrained models from Keras into TensorFlow.js. This section will also cover the ecosystem around TensorFlow.js.
This section contains the following chapters:
  • Chapter 1, Machine Learning for the Web
  • Chapter 2, Importing Pretrained Models into TensorFlow.js
  • Chapter 3, TensorFlow.js Ecosystem

Machine Learning for the Web

In this book, we will learn how to use TensorFlow.js to create machine learning applications. You'll need to be familiar with the following in order to get started:
  • Web-based programming languages, such as JavaScript and TypeScript
  • Web platform technology stacks (only a basic knowledge is required)
  • The fundamentals of machine learning algorithms
In this chapter, we are going to clarify why machine learning on the web is crucial in modern machine learning use cases and when to use web technology so that you can run your applications. You will also be introduced to the basic APIs of TensorFlow.js so that you can construct machine learning models. These topics act as the basis for the chapters that follow.
In this chapter, we will cover the following topics:
  • Why machine learning on the web?
  • Operation graphs
  • What is TensorFlow.js?
  • Installing TensorFlow.js
  • The low-level API
  • The Layers API

Technical requirements

In this chapter, as a prerequisite, you need to prepare the following libraries or frameworks in your environment:
  • A web browser (Chrome is recommended): TensorFlow.js primarily runs on web browsers.
  • The Node.js environment, which contains a node package manager (npm): Node.js is necessary since it resolves dependencies so that we can run TensorFlow.js.
  • TypeScript compiler: TensorFlow.js and its application are often written in TypeScript.
  • Python (3.x is recommended): We need this so that we can run Python-dependent tools such as tfjs-converter and the TensorFlow Python API.
If you are unsure about how to build the environment, please look at the Further reading section, which can be found at the end of this chapter. You will find these resources useful while you set up these prerequisites.
The code we'll be using in this book can be found in this book's GitHub repository: https://github.com/PacktPublishing/Hands-On-Machine-Learning-with-TensorFlow.js.

Why machine learning on the web?

Machine learning technology was invented in the 1950s. Back then, there was no such period where machine learning was the exciting field in computer science that it currently is. However, thanks to breakthroughs in areas of deep learning and artificial intelligence, a huge amount of resources in terms of money and manpower have been devoted to help research it. For example, it isn't unusual to use an extensive amount of computing power that's leveraged by GPUs in laboratories in universities. Nowadays, industries and academics are cooperating to make progress in the computer science field. We are living in an era that's creating and facing large-scale data like never before. The importance of machine learning mainly comes from the demand for providing value by making use of this large-scale data. Machine learning technology gives us a chance to find innovative insights in a scalable and reproducible manner more than ever. For the last decade, intensive research has been done in the machine learning field. Deep learning is one such technology that has achieved accuracy that competes with human intelligence in relation to problems such as image recognition, audio generation, and machine translation. Many machine learning frameworks are emerging and being developed by both academics and industries in order to follow this trend. These technologies can contribute to making such use cases more abundant so that more research can take place.
However, creating a user-friendly application using machine learning is still a challenge. Most machine learning frameworks are designed and optimized to run in an environment that uses distributed systems that are running on thousands of machines and accelerators, such as GPUs. Generally, a machine learning model is used to predict something that's unknown to us after we've trained a model with a known dataset. Environments that contain GPUs and accelerators are exclusively used for the training phase. Although this allows us to train the machine learning model efficiently, it builds a wall between training the model and the inference of the model because it is necessary to make the trained model work on real data. We may need to fine-tune the model with a custom user dataset or convert the model into an executable format in the user's environment. This means that we need to deal with new challenges in terms of integrating between the machine learning model and the user-facing environment when we try to create applications that leverage machine learning technology. Porting machine learning models to platforms that users use often requires intensive work and skill because they're not compatible with the environment. It is common for data scientists who usually use Python as their primary language to struggle with building web applications with JavaScript.
In that sense, the web is the environment that's used the most by the end users of any kind of application. Machine learning applications are not an exception. More and more users are expected to use machine learning applications while they're on the web. Therefore, the web can be seen as the next frontier for machine learning applications because of its potential in terms of how many users use it. The technology that makes machine learning runnable on the web expands the possible use cases for machine learning in the real world. In this book, we are going to learn how to run machine learning on the web by using a modern framework known as TensorFlow.js. TensorFlow.js is a framework that is compatible with TensorFlow APIs so that users can create machine learning applications on the web. Apart from providing the flexibility of web-based machine learning applications, it also provides satisfactory performance since it uses an acceleration mechanism that's provided by modern web browsers.
This book is a practical guide to applying machine learning technologies to the web so that our users can quickly benefit and get value from our applications. It's assumed that you are a developer who wants to create a machine learning application with a rich user interface swiftly and efficiently.

Operation graphs

Before diving into TensorFlow.js itself, we need to be familiar with the idea of operation graphs, or calculation graphs, which are common constructs that we'll use to build machine learning models alongside modern frameworks such as TensorFlow. In these frameworks, the data is represented as a tensor. A tensor is a data structure that represents an arbitrary dimensional array. Those of you who have used the NumPy library in Python may already be familiar with this concept. In NumPy, ndarray is commonly used to display various kinds of data in machine learning, such as images and audio, regardless of whether it's structured or unstructured.
Modern machine learning frameworks, including TensorFlow, illustrates the fact that machine learning models are operation graphs of tensors. An operation graph is defined as a chain that's used for the manipulation or ...

Inhaltsverzeichnis

  1. Title Page
  2. Copyright and Credits
  3. About Packt
  4. Contributors
  5. Preface
  6. Section 1: The Rationale of Machine Learning and the Usage of TensorFlow.js
  7. Machine Learning for the Web
  8. Importing Pretrained Models into TensorFlow.js
  9. TensorFlow.js Ecosystem
  10. Section 2: Real-World Applications of TensorFlow.js
  11. Polynomial Regression
  12. Classification with Logistic Regression
  13. Unsupervised Learning
  14. Sequential Data Analysis
  15. Dimensionality Reduction
  16. Solving the Markov Decision Process
  17. Section 3: Productionizing Machine Learning Applications with TensorFlow.js
  18. Deploying Machine Learning Applications
  19. Tuning Applications to Achieve High Performance
  20. Future Work Around TensorFlow.js
  21. Other Books You May Enjoy
Zitierstile für Hands-On Machine Learning with TensorFlow.js

APA 6 Citation

Sasaki, K. (2019). Hands-On Machine Learning with TensorFlow.js (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/1320627/handson-machine-learning-with-tensorflowjs-a-guide-to-building-ml-applications-integrated-with-web-technology-using-the-tensorflowjs-library-pdf (Original work published 2019)

Chicago Citation

Sasaki, Kai. (2019) 2019. Hands-On Machine Learning with TensorFlow.Js. 1st ed. Packt Publishing. https://www.perlego.com/book/1320627/handson-machine-learning-with-tensorflowjs-a-guide-to-building-ml-applications-integrated-with-web-technology-using-the-tensorflowjs-library-pdf.

Harvard Citation

Sasaki, K. (2019) Hands-On Machine Learning with TensorFlow.js. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/1320627/handson-machine-learning-with-tensorflowjs-a-guide-to-building-ml-applications-integrated-with-web-technology-using-the-tensorflowjs-library-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Sasaki, Kai. Hands-On Machine Learning with TensorFlow.Js. 1st ed. Packt Publishing, 2019. Web. 14 Oct. 2022.