A Data Science Central Community
I want to understand the ways in which Weight of Evidence (WoE) is computed or adjusted in the following scenarios:
1. When number of goods in a class of a variable is 0
2. When number of bads in a class of a variable is 0
WoE = ln(distribution of goods/distributions of bads)
Scenario 1: WoE=ln(0) ?? when number of goods in a class =0.
Scenario 2: WoE=ln(distribution of goods/0)=ln(infinity) ?? when number of bads in a class = 0.
Exactly as you've written - it's undefined for some categories.
Such categories can't be used by logistic regression as well.
You have several options:
- discard attributes having such categories
- merge categories so none of them will have 0 goods/bads
- if it's really significant rule, then exclude records in this category from training sample. You already know that P(good)=0% or 100%; why would you want to train a model for this? Build only for the rest.