TransWikia.com

How to set class_weight parameter for cost sensitive learning?

Data Science Asked on June 6, 2021

I’m dealing with a binary classification problem with a balanced data set, however false positives are much more costly than false negatives. Let’s just say that an FP is in general 3 times more costly than an FN and the response variable = 1 means a positive identification. How should I set the class_weight parameter in sklearn’s RandomForest to reflect this ? From my understanding, I would say:

class_weight = {0:1.0,1:3.0}

I’m not sure if I understand this parameter correctly or should it be the inverse ?

Thanks.

One Answer

begin{array} {|r|r|} hline - &(1) &(0) hline (1) &- &FP hline (0) &FN &- hline end{array}

Rows elements are Y_true and column is Y_pred.

FP means, we predicted Positive and it came out False i.e. Class was Negative(0 here).

It means we don't want the Model to mis-classify the Negative class.
So, it implies, we will put a bigger penalty for the Negative class. Hence,

class_weight = {0:3.0.0,1:1.0}

Correct answer by 10xAI on June 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP