This error typically arises within machine learning frameworks when the shape of the target variable (the data the model is trying to predict) is incompatible with the model’s expected input. Models often anticipate a target variable represented as a single column of values (1-dimensional) or a single value per sample (0-dimensional). Providing a target with multiple columns or dimensions (multi-target) signifies a problem in data preparation or model configuration, leading to this error message. For instance, a model designed to predict a single numerical value (like price) cannot directly handle multiple target values (like price, location, and condition) simultaneously.
Correctly shaping the target variable is fundamental for successful model training. This ensures compatibility between the data and the algorithm’s internal workings, preventing errors and allowing for efficient learning. The expected target shape usually reflects the specific task a model is designed to perform. Regression models frequently require 1-dimensional or 0-dimensional targets, while some specialized models might handle multi-dimensional targets for tasks like multi-label classification. Historical development of machine learning libraries has increasingly emphasized clear error messages to guide users in resolving data inconsistencies.