compute_counter_weight function

Compute counter or weight of data samples