part implementation of under sampling