X numpy array as my features and
y numpy array as my target. I split both of it into train and test data. From many
QnA i have read they only say to
preprocess both train and test separately. I assume i only do it to my feature (X) train and test data and not the target (y). Do we also
preprocess the target?
Not necessarily but depends on what your target(y) is and which algorithm/methodology you are trying to use. It also depends on your data quality.
Few instances that come to my mind:
If your target value is categorical and multilabel in nature, it needs to be one hot encoded, also think about adding extra category to account for unknown classes
If your target is a continuous variable some transformations could work better depending on data distribution and quality- log transforms are common(if no negatives are present),
- Normalization/MinMax scaling etc are employed when different features and targets are in very different scales.
Do we also preprocess the target?
Sometimes. The most common example is scaling the target variable for regression, which is beneficial for some algorithms. Another example is when the distribution of the target variable is skewed and is processed into being normally distributed by log-transformation.