Data cleaning

A predictive model is evaluated on a held-out test set. Where should the parameters for imputing a numeric predictor, such as its median, be estimated?