Beginning with Machine Learning: The Ultimate Introduction to Machine Learning, Deep Learning, Scikit-learn, and TensorFlow (English Edition)
By Dr. Amit Dua and Umair Ayub
()
About this ebook
The book will help readers understand the core concepts of machine learning and techniques to evaluate any machine learning model with ease. The book starts with the importance of machine learning by analyzing its impact on the global landscape. The book also covers Supervised and Unsupervised ML along with Reinforcement Learning. In subsequent chapters, the book explores these topics in even greater depth, evaluating the pros and cons of each and exploring important topics such as Bias-Variance Tradeoff, Clustering, and Dimensionality Reduction. The book also explains model evaluation techniques such as Cross-Validation and GridSearchCV. The book also features mind maps which help enhance the learning process by making it easier to learn and retain information.
This book is a one-stop solution for covering basic ML concepts in detail and the perfect stepping stone to becoming an expert in ML and deep learning and even applying them to different professions.
Related to Beginning with Machine Learning
Related ebooks
Neural Networks: A Practical Guide for Understanding and Programming Neural Networks and Useful Insights for Inspiring Reinvention Rating: 0 out of 5 stars0 ratingsMachine Learning with Tensorflow: A Deeper Look at Machine Learning with TensorFlow Rating: 0 out of 5 stars0 ratingsMachine Learning in Production: Master the art of delivering robust Machine Learning solutions with MLOps (English Edition) Rating: 0 out of 5 stars0 ratingsApplied Machine Learning Solutions with Python: SOLUTIONS FOR PYTHON, #1 Rating: 0 out of 5 stars0 ratingsAdvanced Machine Learning with Python Rating: 0 out of 5 stars0 ratingsPython Machine Learning By Example Rating: 4 out of 5 stars4/5Python Machine Learning Projects: Learn how to build Machine Learning projects from scratch (English Edition) Rating: 0 out of 5 stars0 ratingsMachine Learning in Python: Hands on Machine Learning with Python Tools, Concepts and Techniques Rating: 5 out of 5 stars5/5Deep Learning For Dummies Rating: 0 out of 5 stars0 ratingsArtificial Intelligence Programming with Python: From Zero to Hero Rating: 4 out of 5 stars4/5Machine Learning for Beginners - 2nd Edition: Build and deploy Machine Learning systems using Python (English Edition) Rating: 0 out of 5 stars0 ratingsOperationalizing Machine Learning Pipelines: Building Reusable and Reproducible Machine Learning Pipelines Using MLOps Rating: 0 out of 5 stars0 ratingsApplied Deep Learning: Design and implement your own Neural Networks to solve real-world problems (English Edition) Rating: 0 out of 5 stars0 ratingsMachine Learning - A Comprehensive, Step-by-Step Guide to Intermediate Concepts and Techniques in Machine Learning: 2 Rating: 0 out of 5 stars0 ratingsMachine Learning with Spark and Python: Essential Techniques for Predictive Analytics Rating: 0 out of 5 stars0 ratingsInside Generative AI: A Deep Dive Into Generative AI For Beginners, Professionals, and New Career Seekers Rating: 0 out of 5 stars0 ratingsPython Machine Learning Illustrated Guide For Beginners & Intermediates:The Future Is Here! Rating: 5 out of 5 stars5/5Machine Learning For Beginners Guide Algorithms: Supervised & Unsupervsied Learning. Decision Tree & Random Forest Introduction Rating: 0 out of 5 stars0 ratingsDeep Learning Fundamentals in Python Rating: 4 out of 5 stars4/5
Computers For You
Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 5 out of 5 stars5/5Elon Musk Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5Technical Writing For Dummies Rating: 0 out of 5 stars0 ratingsUX/UI Design Playbook Rating: 4 out of 5 stars4/5The Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms Rating: 0 out of 5 stars0 ratingsStorytelling with Data: Let's Practice! Rating: 4 out of 5 stars4/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsBecoming a Data Head: How to Think, Speak, and Understand Data Science, Statistics, and Machine Learning Rating: 5 out of 5 stars5/5Learning the Chess Openings Rating: 5 out of 5 stars5/5Computer Science I Essentials Rating: 5 out of 5 stars5/5Fundamentals of Programming: Using Python Rating: 5 out of 5 stars5/5The Musician's Ai Handbook: Enhance And Promote Your Music With Artificial Intelligence Rating: 5 out of 5 stars5/5A Quickstart Guide To Becoming A ChatGPT Millionaire: The ChatGPT Book For Beginners (Lazy Money Series®) Rating: 4 out of 5 stars4/5Get Into UX: A foolproof guide to getting your first user experience job Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratings
Reviews for Beginning with Machine Learning
0 ratings0 reviews
Book preview
Beginning with Machine Learning - Dr. Amit Dua
Beginning
with
Machine Learning
The Ultimate Introduction to Machine Learning,
Deep Learning, Scikit-learn, and TensorFlow
Dr. Amit Dua
Umair Ayub
www.bpbonline.com
Copyright © 2023 BPB Online
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 BPB Online 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.
BPB Online has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, BPB Online cannot guarantee the accuracy of this information.
First published: 2023
Published by BPB Online
WeWork, 119 Marylebone Road
London NW1 5PU
UK | UAE | INDIA | SINGAPORE
ISBN 978-93-55511-041
www.bpbonline.com
Dedicated to
Dr. Amit Dua's
My dear wife Nivedita Sood and
My darling daughter Dhriti
Umair Ayub's
My grandparents, parents, and my sister!
About the Authors
Dr. Amit Dua is currently working as an Assistant professor in the Computer Science Department of BITS Pilani, Pilani, where he has been teaching for over six years. Dr Amit is the Honorary Adjunct Distinguished Scientist-Professor and Head of the Blockchain Branch (India) at SIRG. As an educator, he has trained over 6000 students. He is the founder and CEO of Yushu Excellence Technologies Private Limited. Amit’s book on Blockchain Technology and Applications is highly acclaimed amongst academia and research. Dr Amit is the co-author of the Amazon national best-selling books on Machine Learning
and Cybercrime and Cyber Hygiene
. He has published over 50 international publications and filed Indian patents and copyright for Blockchain innovation. Dr Amit is a certified life coach and was awarded as one of the top 10 coaches in 2022. Dr Amit is living to fulfil his mission to help 10 million people realize their true potential.
You can contact Dr. Amit Dua at [email protected]. He is also active on Facebook, Instagram, Youtube, and Linkedin.
Mr. Umair Ayub is a Master's student in Data Science at New York University. He holds a Bachelor's degree in Computer Science and Engineering from the National Institute of Technology in Srinagar. He has worked on a number of projects, including the creation of real-time traffic light coordination using Reinforcement Learning. He's written a book chapter about the Taxonomy of E-Healthcare Systems Using Machine Learning. He is currently using data science to solve real-world business problems.
You can contact Mr. Umair Ayub at mail [email protected]. He is also active on Linkedin.
About the Reviewer
Trayambak Mishra is a senior IT professional who is very passionate about technology and leadership.
He has been working in the IT industry for a decade and helping in the digital transformation and product-building journey of companies across the globe.
A polyglot programmer serving as a Software Solutions Architect and Product owner with deep domain expertise in Machine Learning, Smart TVs, Android, and OTT world.
Acknowledgement
I think the entire learning process started when Birla Institute of Technology and Science authorities allowed me to teach Big Data analytics, an advanced machine learning course, four times to Working professionals.
My dear friend, Dipansh, supported me immensely throughout my research and development work.
I am always grateful and shall remain indebted to my parents, Anita Dua and Bharat Bhushan Dua, for giving me the right environment to explore myself.
I take this opportunity to thank my dear wife, Nivedita, and darling daughter, Dhriti, for being patient throughout this process of writing this book. I have missed their company and have stolen the time reserved for them to write this book.
I could not have improved had my students not given me constructive feedback to help me know what is essential for them and how best I can improve.
My friends in the Tennis club provided me with the right environment to enjoy the process of writing. I firmly believe I could maintain mental calm because of their jolly nature and positive encouragement.
Preface
In the process of teaching the profound science of machine learning, I learned there is a learning process. This process starts with reflecting on how I learned it. I dabbled around many books, online courses, training programs, and several hands-on industrial projects. The one thing that helped me know more about this technology was when I started professionally teaching it a couple of years ago. I must thank my organization for giving me the opportunity to lead this additional course over my regular duties. To teach anything at that level, one needs to practice it in their own life. Especially a practical system like Machine learning.
Hence, I started volunteering as a programmer for many groups and projects. Slowly, I figured out that unless the concepts are implemented correctly, you tend never to gain confidence in them. My learning growth was massive when I started developing ML projects professionally.
I founded a Private limited company to solve practical problems in health care that needed machine learning. Yes, there were failures initially, and I consider them as learnings. I learned that most books try to make the concepts harder to understand. The authors have not taught them, so they don’t present the topic systematically. It appears that five different stories are distinctly put in a book. The diagrams, explanations, and complex mathematics make the expected audience lose connection with the message. Or, the authors have not developed any programming solution at the top-most professional level. The first-time reader is left with practically no choice but systematically understand this profound knowledge.
Development at the Industrial level is a different ball game, and my solid conceptual understanding allowed me to grasp them quickly. I know foundational knowledge separates a developer from the leader in any project. I am a huge fan of this technology, as machine learning has the potential to fix many massive problems in our lives and bring centuries of learning in seconds.
Now imagine that you are given the power to bring about complete learnings of any system and make the decision process as the one who has learned from all the previous experiences. Today, the most prominent authorities in any field are the ones who have learned the most from past experiences of theirs or others. Learning from experience takes time, and applying it depends on your current external and internal situation. We need to learn and apply the correct learnings; this is where ML comes to our rescue. The book addresses these aspects with utmost simplicity, which as a reader, you can start applying right now.
The readers will be exposed to the depth of learning which is summarized as follows :
In Chapter 1, we introduce the idea of Machine Learning and the various reasons it has gained popularity globally. We then discuss what the different tools and software required for successfully implementing Machine Learning models are. We give a brief description of the types of Machine Learning like Supervised, Unsupervised, Semi-supervised, and Reinforcement learning. At the end of the chapter, we see what the different challenges one can encounter are during their implementation.
In Chapter 2, we discuss some of the important terms related to Machine Learning like Generalization, Overfitting, and Underfitting. We then move on to explain the Bias-Variance Tradeoff. We take a detailed look at each of the supervised machine learning algorithms and the different scenarios where they can be used. We also explain how to implement these algorithms successfully and what are the pros and cons of each.
In Chapter 3, we introduce some of the basic concepts of unsupervised machine learning. We look at two of the broad categories of unsupervised machine learning namely Clustering and Dimensionality Reduction. We explain each of these categories in detail. We see the different types of algorithms present in each category, explain their working, and list the pros and cons for the same.
In Chapter 4, we cover some of the most important and frequently used evaluation techniques. We start by explaining Cross-Validation and its different types. We then move on to a complex technique known as GridSearchCV. These are advanced techniques utilized to see the performance of the model. We then introduce evaluation metrics for classification as well as regression. Each one of these evaluation metrics has its pros and cons. The types of metrics to be chosen depends upon the problem at hand.
In Chapter 5, we explain Reinforcement Learning and the concepts behind its implementation. For the sake of this book, we have tried to keep things simple and explain everything at a basic level. We discuss some important terms associated with reinforcement learning like Policy, Policy gradients, Markov Decision Processes. We then look at some of the mathematics behind the successful implementation of reinforcement learning. Towards the end of the chapter, we explain some types of reinforcement learning. In this book, we have only covered the basic and necessary information of these advanced algorithms.
In Chapter 6, we look at some advanced techniques and technologies. We start off by learning about TensorFlow which is the library used for implementing neural networks. We then move onto explaining the different types of neural networks. We explain in detail the fundamentals behind the Artificial Neural Network and its working. We then discuss Convolutional Neural Networks and their architecture. At last, we explain the basic implementation and working of Recurrent Neural Networks and their use case scenarios.
In the Appendix, we provide the practice questions segregated according to the topics covered in chapters 1 to 6. We have observed that learners often practice questions after studying multiple topics. Hence, around 350 practice questions, including short answer type, long answer type, multiple choice, true-false, and fill-in-the-blank type questions, are shared in this section. Many questions have the answers written next to them for your help. Readers can read multiple chapters without breaking the flow as the contents are written using simple English words. Practice questions are presented in the Appendix to revise and refine their understanding.
Code Bundle and Coloured Images
Please follow the link to download the
Code Bundle and the Coloured Images of the book:
https://rebrand.ly/zn3aj8n
The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/Beginning-with-Machine-Learning. In case there's an update to the code, it will be updated on the existing GitHub repository.
We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out!
Errata
We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at :
Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family.
Did you know that BPB offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.bpbonline.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at: [email protected] for more details.
At www.bpbonline.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 BPB books and eBooks.
Piracy
If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author
If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights 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.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions. We at BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about BPB, please visit www.bpbonline.com.
Table of Contents
1. Introduction to Machine Learning
Introduction
Structure
Objectives
What is Machine Learning?
Why Machine Learning?
Tools for Machine Learning
Python
R language
Comparison of R and Python
Golang for ML
JAVA for ML
Scikit-learn
Jupyter Notebook
Numpy
Scipy
Pandas
Matplotlib
Integrated Development Environment (IDE)
Categories of Machine Learning
Supervised learning
Classification
Regression
Unsupervised learning
Semi-Supervised Learning (SSL)
Reinforcement Learning
Introduction to Scikit-learn
Characteristics
Representation of data in scikit-learn
Challenges encountered
Conclusion
2. Supervised Learning
Introduction
Structure
Objectives
Introduction to Supervised Learning
Generalization
Overfitting
Detecting overfitting
Preventing overfitting
Underfitting
Detecting underfitting
Preventing underfitting
Bias-Variance Trade-off
Supervised Machine Learning algorithms
K-Nearest Neighbors
Working of k-NN algorithm
Parameters of KNN Algorithm
Linear Models
Regressive type linear models
Linear models for classification
Naive Bayes classifiers
Bayes theorem
Types of Naive Bayes classifiers
Decision trees
Working of decision trees
Attribute Selection Measure (ASM)
Random Forests
Working of Random Forest
Hyperparameters
Gradient boosted decision trees
Hyperparameters
Conclusion
3. Unsupervised Learning
Introduction
Structure
Objectives
Clustering
Types of clustering
Clustering algorithms
K-Means clustering algorithm
Working of the K-Means algorithm
Evaluation methods
Elbow method
Applications
Drawbacks
Hierarchical clustering
Agglomerative hierarchical clustering
Divisive hierarchical clustering
Dimensionality reduction
The curse of dimensionality
Approaches towards dimensionality reduction
Feature selection
Feature extraction
Linear dimensionality reduction methods
Non-linear dimensionality reduction methods
Conclusion
4. Model Evaluation
Introduction
Structure
Objectives
Cross-validation
Non-exhaustive method
Holdout method
K-fold cross-validation
Stratified K-fold Cross-Validation
Advantages of Cross-Validation
Disadvantages of Cross-Validation
Evaluation metrics
Metrics of classification
Classification Accuracy
Confusion Matrix
Precision
Recall