Problem Overview
The following error occurs when trying to execute a Decision Tree:
Error: Categorical Target Variable must have 2 or more unique values.
Cause
This error occurs when the target variable is categorical but doesn’t contain 2 or more distinct values.
- Result of data filtering: After narrowing down the data, the target variable ends up having only one value
- Data deficiency: The target variable values are uniform in the original dataset
- Variable specification error: The wrong column is specified as the target variable
- Impact of missing values: Valid data is reduced due to missing value processing
Workaround
To resolve this, check the target variable column and ensure it has at least 2 different values.