DescriptionGuides professionals and students through the rapidly growing field of machine learning with hands-on examples in the popular R programming languageMachine Learning—a branch of Artificial Intelligence (AI) which enables computers to improve their results and learn new approaches without explicit instructions—allows organizations to reveal patterns in their data and incorporate predictive analytics into their decision-making process. Practical Machine Learning in R provides a hands-on approach to solving business problems with intelligent, self-learning computer algorithms.Bestselling author and data analytics experts Fred Nwanganga and Mike Chapple explain what machine learning is, demonstrate its organizational benefits, and provide hands-on examples created in the R programming language. A perfect guide for professional self-taught learners or students in an introductory machine learning course, this reader-friendly book illustrates the numerous real-world business uses of machine learning approaches. Clear and detailed chapters cover data wrangling, R programming with the popular RStudio tool, classification and regression techniques, performance evaluation, and more.Explores data management techniques, including data collection, exploration and dimensionality reductionCovers unsupervised learning, where readers identify and summarize patterns using approaches such as apriori, eclat and clusteringDescribes the principles behind the Nearest Neighbor, Decision Tree and Naive Bayes classification techniquesExplains how to evaluate and choose the right model, as well as how to improve model performance using ensemble methods such as Random Forest and XGBoostPractical Machine Learning in R is a must-have guide for business analysts, data scientists, and other professionals interested in leveraging the power of AI to solve business problems, as well as students and independent learners seeking to enter the field.Table of contents About the Authors viiAbout the Technical Editors ixAcknowledgments xiIntroduction xxiPart I: Getting Started 1Chapter 1 What is Machine Learning? 3Discovering Knowledge in Data 5Introducing Algorithms 5Artificial Intelligence, Machine Learning, and Deep Learning 6Machine Learning Techniques 7Supervised Learning 8Unsupervised Learning 12Model Selection 14Classification Techniques 14Regression Techniques 15Similarity Learning Techniques 16Model Evaluation 16Classification Errors 17Regression Errors 19Types of Error 20Partitioning Datasets 22Holdout Method 23Cross-Validation Methods 23Exercises 24Chapter 2 Introduction to R and RStudio 25Welcome to R 26R and RStudio Components 27The R Language 27RStudio 28RStudio Desktop 28RStudio Server 29Exploring the RStudioEnvironment 29R Packages 38The CRAN Repository 38Installing Packages 38Loading Packages 39Package Documentation 40Writing and Running an R Script 41Data Types in R 44Vectors 45Testing Data Types 47Converting Data Types 50Missing Values 51Exercises 52Chapter 3 Managing Data 53The Tidyverse 54Data Collection 55Key Considerations 55Collecting Ground Truth Data 55Data Relevance 55Quantity of Data 56Ethics 56Importing the Data 56Reading Comma-Delimited Files 56Reading Other Delimited Files 60Data Exploration 60Describing the Data 61Instance 61Feature 61Dimensionality 62Sparsity and Density 62Resolution 62Descriptive Statistics 63Visualizing the Data 69Comparison 69Relationship 70Distribution 72Composition 73Data Preparation 74Cleaning the Data 75Missing Values 75Noise 79Outliers 81Class Imbalance 82Transforming the Data 84Normalization 84Discretization 89Dummy Coding 89Reducing the Data 92Sampling 92Dimensionality Reduction 99Exercises 100Part II: Regression 101Chapter 4 Linear Regression 103Bicycle Rentals and Regression 104Relationships Between Variables 106Correlation 106Regression 114Simple Linear Regression 115Ordinary Least Squares Method 116Simple Linear Regression Model 119Evaluating the Model 120Residuals 121Coefficients 121Diagnostics 122Multiple Linear Regression 124The Multiple Linear Regression Model 124Evaluating the Model 125Residual Diagnostics 127Influential Point Analysis 130Multicollinearity 133Improving the Model 135Considering Nonlinear Relationships 135Considering Categorical Variables 137Considering Interactions Between Variables 139Selecting the Important Variables 141Strengths and Weaknesses 146Case Study: Predicting Blood Pressure 147Importing the Data 148Exploring the Data 149Fitting the Simple Linear Regression Model 151Fitting the Multiple Linear Regression Model 152Exercises 161Chapter 5 Logistic Regression 165Prospecting for Potential Donors 166Classifi cation 169Logistic Regression 170Odds Ratio 172Binomial Logistic Regression Model 176Dealing with Missing Data 178Dealing with Outliers 182Splitting the Data 187Dealing with Class Imbalance 188Training a Model 190Evaluating the Model 190Coeffi cients 193Diagnostics 195Predictive Accuracy 195Improving the Model 198Dealing with Multicollinearity 198Choosing a Cutoff Value 205Strengths and Weaknesses 206Case Study: Income Prediction 207Importing the Data 208Exploring and Preparing the Data 208Training the Model 212Evaluating the Model 215Exercises 216Part III: Classification 221Chapter 6 k-Nearest Neighbors 223Detecting Heart Disease 224k-Nearest Neighbors 226Finding the Nearest Neighbors 228Labeling Unlabeled Data 230Choosing an Appropriate k 231k-Nearest Neighbors Model 232Dealing with Missing Data 234Normalizing the Data 234Dealing with Categorical Features 235Splitting the Data 237Classifying Unlabeled Data 237Evaluating the Model 238Improving the Model 239Strengths and Weaknesses 241Case Study: Revisiting the Donor Dataset 241Importing the Data 241Exploring and Preparing the Data 242Dealing with Missing Data 243Normalizing the Data 245Splitting and Balancing the Data 246Building the Model 248Evaluating the Model 248Exercises 249Chapter 7 Naïve Bayes 251Classifying Spam Email 252Naïve Bayes 253Probability 254Joint Probability 255Conditional Probability 256Classification with Naïve Bayes 257Additive Smoothing 261Naïve Bayes Model 263Splitting the Data 266Training a Model 267Evaluating the Model 267Strengths and Weaknesses of the Naïve Bayes Classifier 269Case Study: Revisiting the Heart Disease Detection Problem 269Importing the Data 270Exploring and Preparing the Data 270Building the Model 272Evaluating the Model 273Exercises 274Chapter 8 Decision Trees 277Predicting Build Permit Decisions 278Decision Trees 279Recursive Partitioning 281Entropy 285Information Gain 286Gini Impurity 290Pruning 290Building a Classification Tree Model 291Splitting the Data 294Training a Model 295Evaluating the Model 295Strengths and Weaknesses of the Decision Tree Model 298Case Study: Revisiting the Income Prediction Problem 299Importing the Data 300Exploring and Preparing the Data 300Building the Model 302Evaluating the Model 302Exercises 304Part IV: Evaluating and Improving Performance 305Chapter 9 Evaluating Performance 307Estimating Future Performance 308Cross-Validation 311k-Fold Cross-Validation 311Leave-One-Out Cross-Validation 315Random Cross-Validation 316Bootstrap Sampling 318Beyond Predictive Accuracy 321Kappa 323Precision and Recall 326Sensitivity and Specificity 328Visualizing Model Performance 332Receiver Operating Characteristic Curve 333Area Under the Curve 336Exercises 339Chapter 10 Improving Performance 341Parameter Tuning 342Automated Parameter Tuning 342Customized Parameter Tuning 348Ensemble Methods 354Bagging 355Boosting 358Stacking 361Exercises 366Part V: Unsupervised Learning 367Chapter 11 Discovering Patterns with Association Rules 369Market Basket Analysis 370Association Rules 371Identifying Strong Rules 373Support 373Confi dence 373Lift 374The Apriori Algorithm 374Discovering Association Rules 376Generating the Rules 377Evaluating the Rules 382Strengths and Weaknesses 386Case Study: Identifying Grocery Purchase Patterns 386Importing the Data 387Exploring and Preparing the Data 387Generating the Rules 389Evaluating the Rules 389Exercises 392Notes 393Chapter 12 Grouping Data with Clustering 395Clustering 396k-Means Clustering 399Segmenting Colleges with k-Means Clustering 403Creating the Clusters 404Analyzing the Clusters 407Choosing the Right Number of Clusters 409The Elbow Method 409The Average Silhouette Method 411The Gap Statistic 412Strengths and Weaknesses of k-Means Clustering 414Case Study: Segmenting Shopping Mall Customers 415Exploring and Preparing the Data 415Clustering the Data 416Evaluating the Clusters 418Exercises 420Notes 420Index 421Authors BiographyFRED NWANGANGA, PHD, is an assistant teaching professor of business analytics at the University of Notre Dame’s Mendoza College of Business. He has over 15 years of technology leadership experience.MIKE CHAPPLE, PHD, is associate teaching professor of information technology, analytics, and operations at the Mendoza College of Business. Mike is a bestselling author of over 25 books, and he currently serves as academic director of the University’s Master of Science in Business Analytics program.