# How to design a cost function that has different weights for different types of classification errors?

I'm trying to design a continuous loss function for a logistic classifier.

Suppose I have the following confusion matrix:

[tn  fp
fn  tp]


I want the loss function to be

A*tn + B*fn + C*fp + D*tp


where A, B, C, and D can be different. It's easy enough to implement this discrete version of course, but how can I make this cost function continuous so that my cost function is well-behaved when I try to minimize it?

• If you wish to pursue your original goal of finding an extreme value for the stated discontinuous cost function, you might consult Google with the query "minimizing discontinuous functions". In particular, you might consult the Shor's book "Minimization methods for non-differentiable functions" and Pshnenichnyi's 2 books referenced therein. Also, Matlab has a function for numerical discontinuous minimization that may be of value. – George Kamin Sep 7 '16 at 0:03