Machine Learning for Mobile
上QQ阅读APP看书,第一时间看更新

Introduction to supervised learning algorithms

Let's look at supervised learning for simple day-to-day activities. A parent asks their 15-year-old son to go to the store and get some vegetables. They give him a list of vegetables, say beets, carrots, beans, and tomatoes, that they want him to buy. He goes to the store and is able to identify the list of vegetables as per the list provided by his mother from all the other numerous varieties of vegetables present in the store and put them in his cart before going to the checkout. How was this possible?

Simple. The parent had provided enough training to the son by providing instances of each and every vegetable, which equipped him with sufficient knowledge of the vegetables. The son used the knowledge he has gained to choose the correct vegetables. He used the various attributes of the vegetables to arrive at the correct class label of the vegetable, which, in this case, is the name of the vegetable. The following table gives us a few of the attributes of the vegetables present in the list, by means of which the son was able to recognize the class label, that is, the vegetable name:

 

We just got introduced to supervised learning. We will relate this activity to the key steps of machine learning:

  • Define the ML problem: Purchasing the correct classes of vegetables from all the classes of vegetables present in the store, based on the training and experience already gained on different attributes of the vegetables.
  • Prepare/gather the data and train the model: The 15-year-old son has already been trained with sufficient knowledge of all the vegetables. This knowledge of all the different types of vegetables he has seen and eaten, and of their attributes and features, forms the historical training data for the problem, for the model—the 15-year-old son.
  • Evaluate the model: The son is asked to purchase a few vegetables from the store. This is the test set provided to him to evaluate the model. The task of the model now is to identify the correct class label of the vegetables from the store based on the list provided.

There may be errors in the identification and purchase of correct vegetables in some cases. For example, the son might purchase double beans (a variant of beans) instead of ordinary beans. This may be due to a lack of sufficient training given to him on the distinguishing features between the beans and the double beans. If there is such an error, the parent would retrain him with the new type of vegetable, so that next time, he won't make that mistake.

So, we saw the basic concepts and functions of the supervised machine learning problem. Let's now get into the details of supervised learning.