All notes
4 min read

Debug the data before the model

When an ML experiment behaves strangely, the fastest route forward is often a tiny, slightly boring inspection of the inputs.

Machine LearningDebugging

A model can fail in sophisticated ways, but many experiments fail for ordinary reasons: labels are shifted, units changed halfway through a dataset, or a preprocessing step quietly flattened the signal we cared about.

My first-pass checklist

  • Print shapes, ranges, missing values, and class counts.
  • Visualize a few raw examples before and after preprocessing.
  • Try to overfit a deliberately tiny batch.
  • Compare against a baseline that is almost embarrassingly simple.
python
print(x.shape, y.shape)
print(x.min(), x.max())
print(np.unique(y, return_counts=True))

None of this is glamorous. That is exactly why it works: it removes clever explanations until the pipeline has earned them.