albahnsen/CostSensitiveClassification

Calculation of cost saving

Opened this issue · 2 comments

Hello, thank you very much for the project. I am trying to apply a cost-sensitive learning approach to a marketing problem, where a False Negative (the record is predicted as no-customer, whereas he currently is a customer) is much worse than the opposite. As you can see, the cost-matrix is not example dependent, but class-dependent. I create the example-dependent cost-matrix such the following (it is an example for the first 4 records):

FP FN TP TN
1 2 60 0 0
2 2 60 0 0
3 2 60 0 0
4 2 60 0 0

When I calculate the savings_score() function I get a negative score. Which is the meaning of the 1-cost at the numerator?

I am referring to the following piece of code:

cost = cost_loss(y_true, y_pred, cost_mat)
    return 1.0 - cost / cost_base

The cost value is not normalized, so I really don't understand the meaning of doing 1-.
Thank you very much!

that is a fair question. Allow me to check it and get back to you.

ok, thank you very much!