xgboost: Scale positive weight

For unbalanced data in binary classification this is very important. The logic in xgboost is that class value of 0 = negative class and class value of 1 = positive class. In KNIME however it’s not possible to use a integer as class value for xgboost and there is no setting to define which is the positive class.

It’s completely obscure which class is assigned the positive class. In fact I have string column with 0/1 as classes and 0 seems to be labeled as the positive class.

My suggestion is to have a configuration option to select the positive class value and also allow integer classes where 0 per default is negative class.

1 Like

Hello @beginner,

thank you for bringing this up.
I’ll open a feature request for the selection of the positive class value where I’ll also mention the suggestion about integers but I don’t see the reason for it if it’s possible to specify the positive class.

Until this is implemented you will have to make do with a workaround that achieves the desired behavior:
Currently the classes are assigned in the order of the possible values of the class column i.e. the first possible value gets assigned 0, the second 1 and so on. Therefore you can specify the positive class by changing the order of the possible values via the Edit Nominal Domain node.

Cheers,

Adrian

4 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.