How to assign costs to the confusion matrix
I am trying to assign costs to the confusion matrix. That is, in my problem, a FP does not have the same cost as a FN, so I want to assign to these cases a cost x so that the algorithm learns based on those costs.
I will explain my case a little more with an example:
- When we want to detect credit card fraud, it does not have the same cost to predict that it is not fraud when in fact it is than the other way around. In the first case, the cost would be much higher.
What I wanted to know is if there is a library in R in which I can assign costs to these wrong decisions (i.e. give a cost to each possible value of the confusion matrix) or if there is an algorithm that learns based on a cost/benefit matrix.
I could also use some way to implement this without the use of a library.
Thank you very much.
Topic cost-function evaluation r machine-learning
Category Data Science