All About Target Encoding For Classification Tasks: Setting Context To Implement Target Encoding For Multi-Class Classification. Recently I did a project wherein the target was multi-class.
Recently I did a project wherein the target was multi-class. It was a simple prediction task and the dataset involved both categorical as well as numerical features.
For those of you who are wondering what multi-class classification is: If you want to answer in ‘0 vs 1’, ‘clicked vs not-clicked’ or ‘cat vs dog’, your classification problem is binary; if you want to answer in ‘red vs green vs blue vs yellow’ or ‘sedan vs hatch vs SUV’, then the problem is multi-class.
Therefore, I was researching suitable ways to encode the categorical features. No points for guessing, I was taken to medium articles enumerating benefits of mean target encoding and how it outperforms other methods and how you can use category_encoders library to do the task in just 2 lines of code. However, to my surprise, I found that no article demonstrated this on multi-class target. I went to the documentation of category_encoders and found that it does not say anything about supporting multi-class targets. I dug deeper, scouring through the source code and realized that the library only works for binary or continuous targets.
So I thought: “Inside of every problem lies an opportunity.” — Robert Kiposaki
Going deep, I went straight for the original paper by _Daniele Micci-Barreca _that introduced mean target encoding. Not only for regression problem, the paper gives the solution for both binary classification as well as multi-class classification. This is the same paper that category_encoders cites for target encoding as well.
While there are several articles explaining target encoding for regression and binary classification problems, my aim is to implement target encoding for multi-class variables. However, before that, we need to understand how it’s done for binary targets. In this article, I cover an overview of the paper that introduced target encoding, and show by example how target encoding works for binary problems.
What is wrong with TargetEncoder from category_encoders? This article is in continuation of my previous article that explained how target encoding actually works.
For Big Data Analytics, the challenges faced by businesses are unique and so will be the solution required to help access the full potential of Big Data.
🔵 Intellipaat Data Analytics Training: https://intellipaat.com/data-analytics-master-training-course/In this Data Analytics for beginners video you will le...
🔥Intellipaat Data Analytics training course: https://intellipaat.com/data-analytics-master-training-course/ In this data analytics for beginners video you wi...
Here you will see few very interesting data encoding techniques for categorical features of your machine learning project. Understand what is Categorical Data Encoding.