Prompt
I'm stuck because the data has too many duplicates for training
Latest observation
Oct 17, 2026
OpenAI APIWeb search: off
If your training data has lots of duplicates, you usually want to fix it before modeling, because duplicates can bias the model and make validation look better than it really is.
What to do
- Identify exact duplicates
- Remove rows that are completely identical.
- Check near-duplicates
- For text, images, or records with minor differences, use similarity rules or hashing.
- Deduplicate before splitting
- Don’t split first and dedupe later, or you can leak duplicates into train/test.
- Keep only one copy, or aggregate
- If duplicates represent repeated real events, you may want to keep them but use weights or counts instead of literal repeats.
- Use group-aware splitting
- If duplicates belong to the same entity/user/item, split by group so related rows don’t land in both train and test.
If duplicates are unavoidable
- Use sample weights
- Consider regularization
- Evaluate with a deduplicated validation set
- Use grouped cross-validation
Quick pandas example
df = df.drop_duplicates()
If you want, I can help you with the exact dedup strategy for your data type:
- tabular
- text
- images
- time series
- grouped/user-level data