Supervised learning refers to the task of learning from labeled training data in order to make predictions or classify new, unseen data. In this approach, the algorithm is given a set of labeled examples (input feature vectors and its corresponding output), and the task is to learn a function that maps the input feature vectors to the correspond output. This type of learning is called “supervised” because the data used for training has already been labeled and the algorithm is guided by this “teacher.”

Supervised learning can be classified into regression and classification problems. If the outcome is continuous, the problem is solved via a regression context. And if the outcome has discrete categories, a classification approach is taken.

### Examples

**Maps input features to a “continued output value (numeric)”**

- Use a real-estate dataset of house selling prices to
**predict the estimated selling price of a new house**. The dataset might contain information about the number of beds, bathrooms, square footage, year built, etc. (referred to as input features) and the corresponding selling price (referred as labeled output value). The goal is to learn a function that can accurately learn a mapping between these input features and the output value. Once such a function is learned (supervised learning), we can predict the estimated selling price of a new house by providing the corresponding input features. - Using a company’s financial data,
**predict the stock price**for the next day. Since the price of a stock is a continuous value, this is a regression problem.

**Maps input features to a “discrete output value (categorical)”**

- Using a company’s financial data,
**predict if the stock will go up or down**the next day. Since we are only predicting if the stock price will go up or down (instead of predicting the actual stock price), this is a classification problem - Given a dataset of dog and cat images, learn a function that can correctly
**classify any new image**into a dog or a cat image

The following infographics from Booz Allen Hamilton provides a pictorial explanation of what is supervised learning:

### Video Explanation

In this video, Andrew Ng describes what is Supervised learning, and how the two different types of supervised learning namely regression and classification differ from each other (Runtime: 7 mins)