Hands-On Machine Learning with JavaScript
Solve complex computational web problems
using machine learning
Burak Kanber
BIRMINGHAM - MUMBAI
Hands-On Machine Learning with JavaScript
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Sunith Shetty
Acquisition Editor: Vinay Argekar
Content Development Editor: Aaryaman Singh
Technical Editor: Sayli Nikalje
Copy Editors: Safis Editing
Project Coordinator: Manthan Patel
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Tania Dutta
Production Coordinator: Aparna Bhagat
First published: May 2018
Production reference: 1250518
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78899-824-6
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Burak Kanber is an entrepreneur and engineer with nearly 20 years of experience developing software. After completing graduate school at The Cooper Union, Burak joined a marketing technology startup as co-founder and CTO. Machine learning was not as accessible as it is today, so from 20102012 he wrote a series of articles that taught ML to web developers from first principles. His ML in JS series has since been enjoyed by over a million readers.
Burak is also the co-author of Genetic Algorithms in Java Basics , published by Apress in 2015.
I have been writing about ML in JS for years, and I would like to thank Packt and their team for the opportunity to bring this book to market. I would also like to thank my wife Kimberly for her endless support, love, and patience, especially during the countless hours I spent in my own little world writing this book. I'll never stop trying to make you proud.
About the reviewer
Paulo Pires is a geographical engineer who, in his early thirties, decided to apply his skills in business intelligence. He started working in Webdetails seven years ago and specialized in frontend dashboards with CTools, Pentaho, HTML, JavaScript and its libraries, CSS, and some backend ETL. Currently, he is a senior consultant.
As a hobby, he likes to explore new technologies, and lately he has been playing with Home Automation with Node.js, Sonoff sensors, and Mosquitto broker.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
I started my first deep dive into machine learning (ML) back in 2008 when I was developing algorithms for adaptive traction control systems for electric cars. Shortly thereafter, I moved out of the mechanical engineering field and co-founded a marketing technology startup. Within a few weeks, I realized how important ML was going to be for me and my company, and I decided to read every book and paper on ML that I could find.
I spent the next couple of years with my nose to the grindstone, reading dozens of textbooks and hundreds of academic papers, writing every algorithm I could find from scratch, and slowly developing an intuition and philosophy around ML.
During that period, I discovered a few things about the ML ecosystem that I wasn't too happy with. There was a strong culture of gatekeeping at the time. The idea of writing ML in a language other than Python was considered absurd. There was a sentiment that only people who had gone to school to study ML could possibly be successful in the field. Much of the publicly available reading material, such as blog articles and tutorials online, was written in a distinctly mathematical tone, thereby alienating readers who were unfamiliar with linear algebra and vector calculus.
At the same time, I was teaching a JavaScript (JS) programming bootcamp and many of my studentsself-taught web developersexpressed an interest in ML. It was difficult for me to point them in the right direction; their only option at the time was to move to Python.
This was frustrating to me because I knew that my students were smart enough to grasp ML, and I also knew that ML didn't need to be confined to Python. I also got the sense that many of the developers using the popular Python libraries didn't actually understand the mechanism of the algorithms and would run into problems when trying to implement them. The gatekeeping had backfired and only served to reduce this powerful family of algorithms into black boxes that were applied carelessly by developers that were discouraged from digging deeper and learning more.
Next page