Machine Learning with Scikit-Learn - [Part 39]

in #machine-learning7 years ago

This machine learning tutorial is all about label encoding. Since we are dealing with scikit-learn here, we are going to work on the very classical iris dataset in which flowers are labeled into three categories:

  • setosa
  • versicolor
  • virginica

We are going to encode them the following way: 0 => setosa, 1 => versicolor, 2 => virginica. We are using the LabelEncoder in scikit-learn, which does the encoding automatically.

To verify the encoding, we will be creating more labels of the same in a Python list, and then apply our encoder over them. Ultimately, we'll verify by printing out the encoded list and see if it corresponds with the labels.

Label Encoding is a preprocessing method that is used in many machine learning projects as it makes the training process more efficiently. Please see the video below for the complete tutorial.


To stay in touch with me, follow @cristi


Cristi Vlad Self-Experimenter and Author

Sort:  

Great tutorial! Thanks for taking the time to share it with the steemit community!