Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Hands-on Machine Learning with JavaScript

You're reading from   Hands-on Machine Learning with JavaScript Solve complex computational web problems using machine learning

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781788998246
Length 356 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Burak Kanber Burak Kanber
Author Profile Icon Burak Kanber
Burak Kanber
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Title Page
Packt Upsell
Contributors
Preface
1. Exploring the Potential of JavaScript 2. Data Exploration FREE CHAPTER 3. Tour of Machine Learning Algorithms 4. Grouping with Clustering Algorithms 5. Classification Algorithms 6. Association Rule Algorithms 7. Forecasting with Regression Algorithms 8. Artificial Neural Network Algorithms 9. Deep Neural Networks 10. Natural Language Processing in Practice 11. Using Machine Learning in Real-Time Applications 12. Choosing the Best Algorithm for Your Application 1. Other Books You May Enjoy Index

Example - XOR in TensorFlow.js


In this example, we're going to solve the XOR problem using a TensorFlow.js feedforward neural network. First, let's explore the XOR problem, and why it's a good starting point for us.

The XOR, or exclusive or operation, is a Boolean operator that returns true if only one, but not both, of its inputs is truth. Compare this to the regular Boolean OR that you're more commonly familiar with, which will return true if both inputs are true—the XOR will return false if both inputs are true. Here is a table comparing XOR to OR; I've highlighted the case where OR and XOR differ:

Input 1

Input 2

OR

XOR

False

False

False

False

False

True

True

True

True

False

True

True

True

True

True

False

Why is the XOR problem a good test for us? Let's plot the XOR operations on a graph:

Viewing the preceding graph, we can see that the two classes involved in the XOR operation are not linearly separable. In other words, it is impossible to draw a straight line that separates the circles from the X in the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images