title: XGBoost for multiclassification and imbalanced data
body: <p>I am dealing with a classification problem with 3 classes [0,1,2], and imbalanced class distribution as shown below.</p>
  <p><a href="https://i.stack.imgur.com/ts2Ea.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ts2Ea.png" alt="enter image description here" /></a></p>
  <p>I want to apply <strong>XGBClassifier</strong> (in Python) to this classification problem, but the model does not respond to <code>class_weight</code> adjustments and skews towards the majority class 0, and ignores the minority classes 1,2. Which hyperparameters other than <code>class_weight</code> can help me?</p>
  <p>I tried 1) computing class weights using sklearn <code>compute_class_weight</code>; 2) setting weights according to the relative frequency of the classes; 3) and also manually adjusting classes with extreme values to see if any change happens at all, such as <code>{0:0.5,1:100,2:200}</code>. But in any case, it does not help the classifier to take the minority classes into account.</p>
  <p><strong>Observations:</strong></p>
  <ul>
  <li><p>I can handle the problem in the <em>binary case</em>: If I make the problem a binary classification by identifying classes [1,2], then I can get the classifier work properly by adjusting <code>scale_pos_weight</code> (even in this case <code>class_weight</code> alone does not help).
  But <code>scale_pos_weight</code>, as far as I know, works for binary classification. Is there an analogue of this parameter for the multi-classification problems?</p>
  </li>
  <li><p>Using <code>RandomForestClassifier</code> instead of <code>XGBClassifier</code>, I can handle the problem by setting <code>class_weight='balanced_subsample'</code> and tunning <code>max_leaf_nodes</code>. But, for some reason, this approach does not work for XGBClassifier.</p>
  </li>
  </ul>
  <p><strong>Remark:</strong> I know about balancing techniques, such as over/undersampling, or SMOTE. But I want to avoid them as much as possible, and prefer a solutions using hyperparameter tunning of the model if possible.
  My observation above shows that this can work for the binary case.</p>