2

Suppose we have the following dataset

df = pd.DataFrame({'feature 1':['a','b','c','d','e'],
'feature 2':[1,2,3,4,5],'y':[1,0,0,1,1]})

as we can see feature 1 is categorical. In usual tree-based models as in XGBoost or CatBoost, the values under each feature are treated with the same weight. I was wondering how one can assign weights into individual values of a feature they are categorical? for instance, I want my model to put weight 1 on a, 0.5 on b, 2 on c, 1 on d and 0.6 on e. This is different than assigning weight to a feature as a whole, as I am trying to let the model understand that each value under each feature has their distinct weight.

Wiliam
  • 1,078
  • 10
  • 21

0 Answers0