Solved by ptrblck in post #9 
              
              
                Which sklearn version are you using, as I’m getting an error running your code with random target data: 
targets = np.random.randint(0, 100, (100,))
class_weights = compute_class_weight('balanced', np.unique(targets), targets,classes=np.arange(NUM_POSITIONS))
> TypeError: compute_class_weight() got …