regularize_data function

Regularise a grid of inputs in a dataset