ANGULAR
AND
MACHINE LEARNING
Pocket Primer
LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY
By purchasing or using this book and disc (the Work), you agree that this license grants permission to use the contents contained herein, including the disc, but does not give you the right of ownership to any of the textual content in the book / disc or ownership to any of the information or products contained in it. This license does not permit uploading of the Work onto the Internet or on a network (of any kind) without the written consent of the Publisher. Duplication or dissemination of any text, code, simulations, images, etc. contained herein is limited to and subject to licensing terms for the respective products, and permission must be obtained from the Publisher or the owner of the content, etc., in order to reproduce or network any portion of the textual material (in any media) that is contained in the Work.
MERCURY LEARNING AND INFORMATION (MLI or the Publisher) and anyone involved in the creation, writing, or production of the companion disc, accompanying algorithms, code, or computer programs (the software), and any accompanying Web site or software of the Work, cannot and do not warrant the performance or results that might be obtained by using the contents of the Work. The author, developers, and the Publisher have used their best efforts to insure the accuracy and functionality of the textual material and/or programs contained in this package; we, however, make no warranty of any kind, express or implied, regarding the performance of these contents or programs. The Work is sold as is without warranty (except for defective materials used in manufacturing the book or due to faulty workmanship).
The author, developers, and the publisher of any accompanying content, and anyone involved in the composition, production, and manufacturing of this work will not be liable for damages of any kind arising out of the use of (or the inability to use) the algorithms, source code, computer programs, or textual material contained in this publication. This includes, but is not limited to, loss of revenue or profit, or other incidental, physical, or consequential damages arising out of the use of this Work.
The sole remedy in the event of a claim of any kind is expressly limited to replacement of the book and/or disc, and only at the discretion of the Publisher. The use of implied warranty and certain exclusions vary from state to state, and might not apply to the purchaser of this product.
(Companion files are also available for downloading from the publisher at .)
ANGULAR
AND
MACHINE LEARNING
Pocket Primer
Oswald Campesato
Copyright 2020 by MERCURY LEARNING AND INFORMATION LLC. All rights reserved.
This publication, portions of it, or any accompanying software may not be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means, media, electronic display or mechanical display, including, but not limited to, photocopy, recording, Internet postings, or scanning, without prior permission in writing from the publisher.
Publisher: David Pallai
MERCURY LEARNING AND INFORMATION
22841 Quicksilver Drive
Dulles, VA 20166
www.merclearning.com
(800) 232-0223
O. Campesato. Angular and Machine Learning Pocket Primer.
ISBN: 9781683924708
The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. All brand names and product names mentioned in this book are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks, etc. is not an attempt to infringe on the property of others.
Library of Congress Control Number: 2020934206
202122 321 Printed on acid-free paper in the United States of America
Our titles are available for adoption, license, or bulk purchase by institutions, corporations, etc. For additional information, please contact the Customer Service Dept. at (800) 232-0223(toll free).
Digital versions of our titles are available at: .
The sole obligation of MERCURY LEARNING AND INFORMATION to the purchaser is to replace the book and/or disc, based on defective materials or faulty workmanship, but not based on the operation or functionality of the product.
Id like to dedicate this book to my parents may this bring joy and happiness into their lives.
CONTENTS
PREFACE
What is the Goal?
The goal of this book is to introduce advanced beginners to basic machine learning and incorporate that knowledge into Angular 8 applications. This book is intended to be a fast-paced introduction to some basic features of machine learning and an overview of several popular machine learning classifiers. It includes code samples that are part of a university course taught by the author of this book.
This book will save you the time required to search for code samples, which is a potentially time-consuming process. If youre not sure whether you can absorb the material in this book, glance through the code samples to get a feel for the level of complexity.
At the risk of stating the obvious, please keep in mind the following point: you will not become an expert in machine learning or Angular 8 by reading this book.
What Will I Learn from This Book?
The first three chapters contain a short tour of basic Angular functionality, such as UI components and forms in Angular applications. The fourth chapter introduces you to machine learning concepts, such as supervised and unsupervised learning, followed by the major types of machine learning algorithms (regression, classification, and clustering), along with a section discussing linear regression. The fifth chapter is devoted to classification algorithms, such as kNN, Nave Bayes, decision trees, random forests, and SVM (Support Vector Machines).
The sixth chapter introduces basic TensorFlow concepts, followed by TensorFlow.js (i.e., TensorFlow in modern browsers) and some examples of Angular applications combined with machine learning. The appendix contains an introduction to Keras, along with some basic code samples.
Although Jupyter is popular, all the code samples in this book are Python scripts. However, you can quickly learn about the useful features of Jupyter through various online tutorials. In addition, its worth looking at Google Colaboratory: it is entirely online, is based on Jupyter notebooks, and offers free GPU usage.
How Much Keras Knowledge is Needed for This Book?
Some exposure to Keras is helpful, and you can read the appendix if Keras is new to you. If you also want to learn about Keras and logistic regression, there is an example in Chapter 3. This example requires some theoretical knowledge involving activation functions, optimizers, and cost functions, all of which are discussed in Chapter 4.
Please keep in mind that Keras is well-integrated into TensorFlow 2 (in the tf.keras namespace), and it provides a layer of abstraction over the pure TensorFlow that will enable you to develop prototypes more quickly.
Do I Need to Learn the Theory Portions of This Book?
Once again, the answer depends on the extent to which you plan to become involved in machine learning. In addition to creating a model, you will use various algorithms to see which ones provide the level of accuracy (or some other metric) that you need for your project. If you fall short, the theoretical aspects of machine learning can help you perform a forensic analysis of your model and your data, and ideally assist in determining how to improve your model.