skyunyoo:

Should I set the value of pos_weight randomly without calculating like this?


Yes, for the same of debugging try out different values and check the confusion matrix to verify that the predictions really change.



 skyunyoo:

The confusing part of this sampler is when there is llabel(value have 1) and no label(value only 0) (i.e. binary problem),


You should use both classes to calculate the class count and assign the computed weight to each sample.