Thanks for the note. I think the simpler one is surely working but I am not sure whether it would guarantee the smaller class will be drawn while the larger classes maintain the majority. UNLESS I set the smaller set significantly heavily, somehow make it close to the larger set. But in that case, it will be more like an instance-balance sampling than class-balance sampling. Do you happen to recommend any reference customized sampler sample codes that serve similar tasks ?