Book Image

Hands-on Machine Learning with JavaScript

Book Image

Hands-on Machine Learning with JavaScript

Overview of this book

In over 20 years of existence, JavaScript has been pushing beyond the boundaries of web evolution with proven existence on servers, embedded devices, Smart TVs, IoT, Smart Cars, and more. Today, with the added advantage of machine learning research and support for JS libraries, JavaScript makes your browsers smarter than ever with the ability to learn patterns and reproduce them to become a part of innovative products and applications. Hands-on Machine Learning with JavaScript presents various avenues of machine learning in a practical and objective way, and helps implement them using the JavaScript language. Predicting behaviors, analyzing feelings, grouping data, and building neural models are some of the skills you will build from this book. You will learn how to train your machine learning models and work with different kinds of data. During this journey, you will come across use cases such as face detection, spam filtering, recommendation systems, character recognition, and more. Moreover, you will learn how to work with deep neural networks and guide your applications to gain insights from data. By the end of this book, you'll have gained hands-on knowledge on evaluating and implementing the right model, along with choosing from different JS libraries, such as NaturalNode, brain, harthur, classifier, and many more to design smarter applications.
Table of Contents (14 chapters)

To get the most out of this book

If you haven't programmed in JS in a while, it would be best for you to give yourself a refresher before you get started. In particular, the examples in this book will use ES6/ES2015 syntax; I will give you a tour of the new syntax in the first chapter, but you may also want to become familiar with it on your own.

If you don't have Node.js installed yet, you'll want to install that now. The examples in this book were written using Node.js version 9.6.0, though I expect most of the examples to work for any Node.js version greater than 8 and for Node.js version 10 as well.

You will not need much education in math to get through this book, but I assume that you paid attention to your high school math courses. If you don't remember much probability, statistics, or algebra, you may want to refresh yourself on those topics, as they are prevalent in ML. While I have tried my best to avoid deep dives into advanced mathematical concepts, I will indeed have to present some in this book so that you at least get a level of comfort with math and the willingness to research some select mathematical concepts on your own.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Machine-Learning-with-JavaScript. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Use the command line, your favorite IDE, or your file browser to create a directory somewhere on your machine called MLinJSBook, with a subdirectory called Ch1-Ex1."

A block of code is set as follows:

var items = [1, 2, 3 ];
for (var index in items) {
var item = items[index];

}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

['landscape.jpeg', 'lily.jpeg', 'waterlilies.jpeg'].forEach(filename => {
console.log("Decolorizing " + filename + '...');
decolorize('./files/' + filename)
.then(() => console.log(filename + " decolorized"));
});

Any command-line input or output is written as follows:

$ node --version
V9.4.0

Bold: Indicates a new term, an important word, or words that you see onscreen.

Warnings or important notes appear like this.
Tips and tricks appear like this.