Feature Selection Bug Risk When Labels Are Not the Final Data Column
Summary
The post raises a feature-selection issue in two model implementations: both select dataframe columns by taking everything after the first two columns and before the last. This works when the dataframe is ordered as datetime, symbol, features, label, because the label is then last and excluded from the selected features.
If factor-feature data is merged into the dataset and the label no longer occupies the last position, that positional slice may include the label as an input during model fitting. This would leak the target into the features and invalidate training or evaluation. The post is a reported code concern rather than a confirmed diagnosis; it offers no reproduction, fix, or test results. Its main lesson is to select features by explicit column names or exclude metadata and target columns directly, rather than relying on column order.
Key ideas
- Selecting columns by position assumes the label remains the final column.
- Merging factor data may move the label and cause it to be included among model inputs.
- Including the target as a feature creates label leakage and undermines model evaluation.
- The report does not confirm the bug or provide a tested correction.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.