Decision Tree Analytics fails with: Error: Categorical Target Variable must have 2 or more unique values

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.

  1. Result of data filtering: After narrowing down the data, the target variable ends up having only one value
  2. Data deficiency: The target variable values are uniform in the original dataset
  3. Variable specification error: The wrong column is specified as the target variable
  4. 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.