Preprocessing and sampling is done