Introduction
In the previous chapters, we explored some of packages of R, such as the dplyr, plyr, lubridate, and ggplot2, where we discussed the basics of storing and processing data in R. Later, the same ideas were used in Exploratory Data Analysis (EDA) to understand the ways to break data into smaller parts, extract insights from data, and explore other ways to understand the data better, before venturing into advanced modeling techniques.
In this chapter, we will take one step further toward introducing machine learning ideas. While broadly laying the foundation for thinking about various algorithms in machine learning, we will discuss supervised learning at length.
Supervised learning is based on data that is well labeled by domain experts. For classifying cats and dogs from images, an algorithm first needs to see the images labeled as cats and dogs and then learn the features based on the label. Most enterprises with a good volume of historical data are the biggest beneficiaries of the wealth of knowledge they can extract from such data. If the data is clean and annotated well, supervised learning can result in a high accuracy of prediction, unlike other machine learning algorithms, which generally produce large errors in the beginning. In the absence of the right labels, it becomes difficult to derive any meaning out of data, other than just being able to do exploratory analysis and clustering.
The standard component in solving real-world problems like predicting loan default (yes/no), failure of manufacturing machines in factories (yes/no), object detection in driverless cars (road, car, signal), predicting stock market prices (numeric) is a set of inputs (features) and a given output (label), which is usually obtained from historical data. When we predict the quantitative output, we call it regression, and when we predict the qualitative output, we call it classification.