What is mode imputation?
Mode imputation is a method for handling missing values by replacing each missing value with the most frequently occurring value in that feature.
It is especially common for categorical data.
Simple example
Suppose a feature contains:
Red, Blue, Red, missing, Red, GreenThe most frequent value is:
RedSo the missing value can be replaced with Red.
When mode imputation is useful
Mode imputation can be a reasonable choice when:
- the feature is categorical
- one category occurs more often than the others
- only a limited amount of data is missing
- keeping all rows is preferable to removing incomplete records
It can also be used with discrete numerical values when using the most common value makes sense.
Limitations of mode imputation
Replacing missing values with the most common category can distort the original distribution.
It may:
- make the dominant category even more common
- reduce variation in the feature
- hide useful information about why values are missing
- be misleading when multiple categories have similar frequencies
In some cases, creating a separate category such as Unknown may preserve more information than replacing missing values with the mode.
What if there is more than one mode?
A feature can have multiple values tied for the highest frequency.
In that case, the imputation rule should be defined consistently, such as choosing one category using a fixed rule rather than making an arbitrary choice each time.
Avoid data leakage
The mode should be calculated using the training data only.
The learned mode can then be applied to validation and test data.
In short, mode imputation replaces missing values with the most frequently occurring value in a feature and is commonly used for categorical data, but it can overrepresent the dominant category if used carelessly.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.