Hi Andrea,
Starting high level: To train unbalanced classes 'fairly', we want to increase the importance of the under-represented class(es).
To do this, we need to chose a reference class. You can pick any class to serve as the reference, but conceptually, I like the majority class (the one with the most samples).
Creating your class_weight dictionary:
1. determine the ratio of reference_class/other_class. If you choose class_0 as your reference, you'll have (1000/1000, 1000/500, 1000/100) = (1,2,10)
2. map the class label to the ratio: class_weight={0:1, 1:2, 2:10}
Conceptually, what your dict is saying is that, during training, class_1 should be treated as 2x as important as class_0. Likewise class_2 should be treated as 10x as important as class_0 and 5x as important as class_1